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


PHP Customers::get_customers方法代码示例

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


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

示例1: action_bill

 public function action_bill()
 {
     $this->xml_content_customers = $this->xml_content->appendChild($this->dom->createElement('customers'));
     xml::to_XML(Customers::get_customers(), $this->xml_content_customers, 'customer', 'id');
     $template = array();
     foreach (glob(MODPATH . 'larvconomy/xsl/bills/*') as $file) {
         $file_paths = explode('/', $file);
         $template_file = explode('.', end($file_paths));
         $template[] = reset($template_file);
     }
     $this->xml_content_bill_template = $this->xml_content->appendChild($this->dom->createElement('templates'));
     xml::to_XML($template, $this->xml_content_bill_template, 'template');
     if (!isset($_SESSION['bills']['items'])) {
         $_SESSION['bills']['items']['1item'] = 1;
     }
     if (count($_POST)) {
         $post = new Validation($_POST);
         $post->filter('trim');
         $post_array = $post->as_array();
         if (isset($post_array['add_item'])) {
             $_SESSION['bills']['items'][count($_SESSION['bills']['items']) + 1 . 'item'] = count($_SESSION['bills']['items']) + 1;
             $this->set_formdata($post_array);
         } else {
             $items = array();
             $sum = 0;
             $vat_sum = 0;
             foreach ($_SESSION['bills']['items'] as $item_nr) {
                 $item = array('artnr' => $post->get('artnr_item_' . $item_nr), 'spec' => $post->get('spec_item_' . $item_nr), 'price' => (double) $post->get('price_item_' . $item_nr), 'qty' => (double) $post->get('qty_item_' . $item_nr), 'delivery_date' => date('Y-m-d', time()));
                 if ($item != array('artnr' => '', 'spec' => '', 'price' => 0, 'qty' => 0, 'delivery_date' => date('Y-m-d', time()))) {
                     $items[] = $item;
                     $sum += $item['qty'] * $item['price'] * 1.25;
                     $vat_sum += $item['qty'] * $item['price'] * 0.25;
                 }
             }
             if (count($items) && $post->validate()) {
                 $bill_id = Bill::new_bill($post->get('customer_id'), strtotime($post->get('due_date')), $post->get('contact'), $items, $post->get('comment'), $post->get('template'), $post->get('mail_body'));
                 $this->add_message('Created bill nr ' . $bill_id);
                 unset($_SESSION['bills']['items']);
                 // Create the transaction
                 $data = array('accounting_date' => date('Y-m-d', time()), 'transfer_date' => '0000-00-00', 'description' => 'Bill ' . $bill_id, 'vat' => $vat_sum, 'sum' => $sum, 'employee_id' => NULL, 'journal_id' => NULL);
                 $transaction = new Transaction(NULL, $data);
                 // End of Create the transaction
                 // Set new default due date
                 $this->set_formdata(array('due_date' => date('Y-m-d', time() + 20 * 24 * 60 * 60)));
                 // Make the PDF
                 if (Kohana::$config->load('larv.htpassword.password') && Kohana::$config->load('larv.htpassword.username')) {
                     shell_exec('wkhtmltopdf --ignore-load-errors --username ' . Kohana::$config->load('larv.htpassword.username') . ' --password ' . Kohana::$config->load('larv.htpassword.password') . ' "' . $_SERVER['SERVER_NAME'] . URL::site('bill?billnr=' . $bill_id . '&template=' . $post->get('template')) . '" "' . APPPATH . 'user_content/pdf/bill_' . $bill_id . '.pdf"');
                 } else {
                     shell_exec('wkhtmltopdf --ignore-load-errors "' . $_SERVER['SERVER_NAME'] . URL::site('bill?billnr=' . $bill_id . '&template=' . $post->get('template')) . '" "' . APPPATH . 'user_content/pdf/bill_' . $bill_id . '.pdf"');
                 }
                 if (isset($_FILES)) {
                     Bill::upload($_FILES, 'attachments/' . $bill_id);
                 }
             } else {
                 $this->add_error('Not enough data');
                 $post->set('due_date', date('Y-m-d', strtotime($post->get('due_date'))));
                 $post->set('mail_body', Kohana::$config->load('larv.email.bill_message'));
                 $this->set_formdata($post->as_array());
             }
         }
     } else {
         $this->set_formdata(array('due_date' => date('Y-m-d', time() + 20 * 24 * 60 * 60), 'mail_body' => Kohana::$config->load('larv.email.bill_message')));
     }
     xml::to_XML($_SESSION['bills'], $this->xml_content);
 }
开发者ID:rockymontana,项目名称:larvconomy,代码行数:65,代码来源:bills.php

示例2: action_index

 public function action_index()
 {
     $this->xml_content_customers = $this->xml_content->appendChild($this->dom->createElement('customers'));
     xml::to_XML(Customers::get_customers(), $this->xml_content_customers, 'customer', 'id');
 }
开发者ID:rockymontana,项目名称:larvconomy,代码行数:5,代码来源:customers.php


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