当前位置: 首页>>代码示例>>PHP>>正文


PHP DiscountAbsolute::link_to_ticket方法代码示例

本文整理汇总了PHP中DiscountAbsolute::link_to_ticket方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscountAbsolute::link_to_ticket方法的具体用法?PHP DiscountAbsolute::link_to_ticket怎么用?PHP DiscountAbsolute::link_to_ticket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DiscountAbsolute的用法示例。


在下文中一共展示了DiscountAbsolute::link_to_ticket方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insert


//.........这里部分代码省略.........
     $sql .= " " . price2num($this->localtax1_tx) . ",";
     $sql .= " " . price2num($this->localtax2_tx) . ",";
     if ($this->fk_product) {
         $sql .= "'" . $this->fk_product . "',";
     } else {
         $sql .= 'null,';
     }
     $sql .= " " . $this->product_type . ",";
     $sql .= " " . price2num($this->remise_percent) . ",";
     $sql .= " " . price2num($this->subprice) . ",";
     $sql .= " " . price2num($this->price) . ",";
     $sql .= " " . ($this->remise ? price2num($this->remise) : '0') . ",";
     // Deprecated
     if ($this->fk_remise_except) {
         $sql .= $this->fk_remise_except . ",";
     } else {
         $sql .= 'null,';
     }
     if ($this->date_start) {
         $sql .= "'" . $this->db->idate($this->date_start) . "',";
     } else {
         $sql .= 'null,';
     }
     if ($this->date_end) {
         $sql .= "'" . $this->db->idate($this->date_end) . "',";
     } else {
         $sql .= 'null,';
     }
     $sql .= ' ' . $this->fk_code_ventilation . ',';
     $sql .= ' ' . $this->fk_export_compta . ',';
     $sql .= ' ' . $this->rang . ',';
     //$sql.= ' '.$this->special_code.',';
     $sql .= " '" . $this->info_bits . "',";
     $sql .= " " . price2num($this->total_ht) . ",";
     $sql .= " " . price2num($this->total_tva) . ",";
     $sql .= " " . price2num($this->total_ttc) . ",";
     $sql .= " " . price2num($this->total_localtax1) . ",";
     $sql .= " " . price2num($this->total_localtax2) . ",";
     $sql .= $this->note ? "'" . $this->db->escape($this->note) . "'" : "null";
     $sql .= ')';
     dol_syslog("TicketLigne::insert sql=" . $sql);
     $resql = $this->db->query($sql);
     if ($resql) {
         $this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX . 'pos_ticketdet');
         // Si fk_remise_except defini, on lie la remise a la ticket
         // ce qui la flague comme "consommee".
         if ($this->fk_remise_except) {
             $discount = new DiscountAbsolute($this->db);
             $result = $discount->fetch($this->fk_remise_except);
             if ($result >= 0) {
                 // Check if discount was found
                 if ($result > 0) {
                     // Check if discount not already affected to another ticket
                     if ($discount->fk_ticket) {
                         $this->error = $langs->trans("ErrorDiscountAlreadyUsed", $discount->id);
                         dol_syslog("TicketLigne::insert Error " . $this->error, LOG_ERR);
                         $this->db->rollback();
                         return -3;
                     } else {
                         $result = $discount->link_to_ticket($this->rowid, 0);
                         if ($result < 0) {
                             $this->error = $discount->error;
                             dol_syslog("TicketLigne::insert Error " . $this->error, LOG_ERR);
                             $this->db->rollback();
                             return -3;
                         }
                     }
                 } else {
                     $this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded");
                     dol_syslog("TicketLigne::insert Error " . $this->error, LOG_ERR);
                     $this->db->rollback();
                     return -3;
                 }
             } else {
                 $this->error = $discount->error;
                 dol_syslog("TicketLigne::insert Error " . $this->error, LOG_ERR);
                 $this->db->rollback();
                 return -3;
             }
         }
         if (!$notrigger) {
             // Appel des triggers
             include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
             $interface = new Interfaces($this->db);
             $result = $interface->run_triggers('LINEBILL_INSERT', $this, $user, $langs, $conf);
             if ($result < 0) {
                 $error++;
                 $this->errors = $interface->errors;
             }
             // Fin appel triggers
         }
         $this->db->commit();
         return $this->rowid;
     } else {
         $this->error = $this->db->error();
         dol_syslog("TicketLigne::insert Error " . $this->error, LOG_ERR);
         $this->db->rollback();
         return -2;
     }
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:101,代码来源:ticket.class.php


注:本文中的DiscountAbsolute::link_to_ticket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。