コード例 #1
0
 public function getcontactAction()
 {
     // 请求参数
     $request = $this->getRequest()->getParams();
     $contact = new Erp_Model_Contact();
     // 查询条件
     $condition = array('type' => 1, 'key' => isset($request['key']) && $request['key'] != '' ? $request['key'] : null, 'page' => isset($request['page']) ? $request['page'] : 1, 'limit' => isset($request['limit']) ? $request['limit'] : 0);
     echo Zend_Json::encode($contact->getContact($condition));
     exit;
 }
コード例 #2
0
ファイル: OrderController.php プロジェクト: xindalu/evolve
 public function getprintAction()
 {
     $result = array('success' => true, 'info' => '');
     $request = $this->getRequest()->getParams();
     if (isset($request['id']) && isset($request['tpl_id'])) {
         $order = new Erp_Model_Purchse_Order();
         $buyer = new Erp_Model_Purchse_Buyer();
         $items = new Erp_Model_Purchse_Orderitems();
         $helper = new Application_Model_Helpers();
         $supplier_contact = new Erp_Model_Contact();
         $tax = new Erp_Model_Setting_Tax();
         $currency = new Erp_Model_Setting_Currency();
         $orderData = $order->getData(null, $request['id']);
         $itemsData = $items->getData($request['id']);
         $buyerData = $buyer->getData($orderData['buyer_id']);
         $supplierContactData = $supplier_contact->getData($orderData['supplier_contact_id']);
         $taxData = $tax->getData($orderData['supplier_tax_id']);
         $currencyData = $currency->getInfoByCode($orderData['currency']);
         $tpl = new Erp_Model_Tpl();
         $tplHtmlData = $tpl->fetchRow("id = " . $request['tpl_id'])->toArray();
         $tplHtml = $tplHtmlData['html'];
         $itemsHtml = '';
         $itemsHtml_en = '';
         $itemsHtml_other = '';
         $i = 0;
         foreach ($itemsData as $item) {
             $i++;
             $req_number = str_replace(',', '<br>', $item['items_req_number']);
             $itemsHtml .= '
                 <tr>
                     <td>' . $i . '</td>
                     <td>' . $item['items_code'] . '</td>
                     <td width="100px">' . $item['items_name'] . '</td>
                     <td width="150px">' . $item['items_description'] . '</td>
                     <td>' . $item['items_qty'] . '</td>
                     <td>' . $item['items_unit'] . '</td>
                     <td>' . $currencyData['symbol'] . $item['items_price'] . '</td>
                     <td>' . $currencyData['symbol'] . $item['items_total'] . '</td>
                     <td>' . $req_number . '</td>
                     <td>' . $item['items_request_date'] . '</td>
                     <td>' . $item['items_remark'] . '</td>
                 </tr>';
             $itemsHtml_en .= '
                 <tr>
                     <td>' . $i . '</td>
                     <td>' . $item['items_code'] . '</td>
                     <td width="100px" style="word-wrap:break-word;">' . $item['items_name'] . '</td>
                     <td width="150px" style="word-wrap:break-word;">' . $item['items_description'] . '</td>
                     <td>' . $item['items_qty'] . '</td>
                     <td>' . $item['items_unit'] . '</td>
                     <td>' . $currencyData['symbol'] . $item['items_price'] . '</td>
                     <td>' . $currencyData['symbol'] . $item['items_total'] . '</td>
                     <td>' . $req_number . '</td>
                     <td>' . $item['items_request_date'] . '</td>
                     <td>' . $item['items_remark'] . '</td>
                 </tr>';
             $itemsHtml_other .= '
                 <tr>
                     <td>' . $i . '</td>
                     <td>' . $item['items_code'] . '</td>
                     <td width="250px" style="word-wrap:break-word;">' . $item['items_name'] . ' [' . $item['items_description'] . ']</td>
                     <td>' . $item['items_qty'] . '</td>
                     <td>' . $item['items_unit'] . '</td>
                     <td>' . $currencyData['symbol'] . $item['items_price'] . '</td>
                     <td>' . $currencyData['symbol'] . $item['items_total'] . '</td>
                     <td>' . $req_number . '</td>
                     <td>' . $item['items_request_date'] . '</td>
                     <td>' . $item['items_remark'] . '</td>
                 </tr>';
         }
         $receive = array();
         if ($orderData['receiver_id']) {
             // 公司收货人
             $receiver = new Erp_Model_Warehouse_Warehousereceiver();
             $receiverData = $receiver->getData($orderData['receiver_id']);
             $receive['address'] = $receiverData['address'];
             $receive['address_en'] = $receiverData['address_en'];
             $receive['cname'] = $receiverData['cname'];
             $receive['ename'] = $receiverData['ename'];
             $receive['tel'] = $receiverData['tel'];
             $receive['fax'] = $receiverData['fax'];
         } else {
             // 客户收货人
             $receiverData = $supplier_contact->getDataByCode($orderData['customer_address_code']);
             $receive['address'] = $receiverData['address'];
             $receive['address_en'] = $receiverData['address'];
             $receive['cname'] = $receiverData['name'];
             $receive['ename'] = $receiverData['name'];
             $receive['tel'] = $receiverData['tel'];
             $receive['fax'] = $receiverData['fax'];
         }
         $orderInfo = array('order_symbol' => $currencyData['symbol'], 'company_name' => '成都欧飞凌通讯技术有限公司', 'company_tel' => '028-85161178', 'company_fax' => '028-85161176', 'company_address' => '成都市高新区云华路333号1-5栋 3层', 'company_logo' => HOME_PATH . '/public/images/company.png', 'company_tax' => '510198698882411', 'company_account' => '128904731510811', 'company_bank' => '招商银行成都分行高新支行', 'order_title' => '采 购 合 同', 'type' => ' - 物料原材料', 'number' => $orderData['number'], 'date' => date('Y-m-d', strtotime($orderData['create_time'])), 'contact_name' => $buyerData['cname'], 'contact_ename' => $buyerData['ename'], 'contact_tel' => $buyerData['tel'], 'contact_fax' => $buyerData['fax'], 'supplier_cname' => $orderData['supplier_cname'], 'supplier_ename' => $orderData['supplier_ename'], 'supplier_code' => $orderData['supplier_code'], 'supplier_bank_type' => $orderData['supplier_bank_type'], 'supplier_bank_account' => $orderData['supplier_bank_account'], 'supplier_address' => $supplierContactData['address'], 'supplier_contact_name' => $supplierContactData['name'], 'supplier_contact_tel' => $supplierContactData['tel'], 'supplier_contact_fax' => $supplierContactData['fax'], 'receive_address' => $receive['address'], 'receive_address_en' => $receive['address_en'], 'receive_cname' => $receive['cname'], 'receive_ename' => $receive['ename'], 'receive_tel' => $receive['tel'], 'receive_fax' => $receive['fax'], 'total_upper' => $helper->num2rmb($orderData['total']), 'total_lower' => $orderData['currency_rate'] != 1 ? $orderData['forein_total'] : $orderData['total'], 'supplier_tax' => $orderData['supplier_tax_num'], 'supplier_tax_name' => $taxData['name'], 'supplier_tax_rate' => $taxData['rate'], 'supplier_payment_days' => $orderData['supplier_payment'], 'settle_way' => $orderData['settle_way'], 'delvery_clause' => $orderData['delvery_clause'], 'manufacture' => $orderData['manufacture'], 'responsible' => $orderData['responsible'], 'table' => $itemsHtml, 'table_en' => $itemsHtml_en, 'table_other' => $itemsHtml_other, 'order_other_info' => $orderData['remark'], 'responsible' => $orderData['responsible'], 'order_title_en' => 'Purchase Order', 'order_title_other' => '设 备 类 采 购 合 同', 'company_name_en' => 'OPhylink Communication Technology Inc.');
         foreach ($orderInfo as $key => $val) {
             $tplHtml = str_replace('<tpl_' . $key . '>', $val, $tplHtml);
         }
         $result['info'] = $tplHtml;
     } else {
         $result['success'] = false;
     }
     /* echo $tplHtml;
        exit; */
     echo Zend_Json::encode($result);
     exit;
 }
コード例 #3
0
ファイル: ReqController.php プロジェクト: xindalu/evolve
 /**
  * 根据业务伙伴ID获取联系方式列表
  */
 public function getcontactAction()
 {
     $data = array();
     $request = $this->getRequest()->getParams();
     $partner_id = isset($request['partner_id']) ? $request['partner_id'] : 0;
     if ($partner_id > 0) {
         $contact = new Erp_Model_Contact();
         $record = $contact->fetchAll("partner_id = " . $partner_id)->toArray();
         foreach ($record as $rec) {
             $active = $rec['active'] == 1 ? true : false;
             array_push($data, array('contact_id' => $rec['id'], 'contact_partner_id' => $rec['partner_id'], 'contact_active' => $active, 'contact_name' => $rec['name'], 'contact_post' => $rec['post'], 'contact_tel' => $rec['tel'], 'contact_fax' => $rec['fax'], 'contact_email' => $rec['email'], 'contact_country' => $rec['country'], 'contact_area' => $rec['area'], 'contact_address' => $rec['address'], 'contact_zip_code' => $rec['zip_code'], 'contact_remark' => $rec['remark']));
         }
     }
     echo Zend_Json::encode($data);
     exit;
 }
コード例 #4
0
ファイル: SendController.php プロジェクト: xindalu/evolve
 /**
  * 获取联系人信息
  */
 public function getlinkmanAction()
 {
     $partner_id = $this->getRequest()->getParam('partner_id');
     if ($partner_id) {
         $contact = new Erp_Model_Contact();
         $where = "email != '' and partner_id = {$partner_id}";
         $data = $contact->getJoinList($where, array(), array('id', 'email', 'name' => "concat(name, '(', email, ')')"));
         echo Zend_Json::encode($data);
         exit;
     } else {
         echo Zend_Json::encode(array());
         exit;
     }
 }
コード例 #5
0
ファイル: BpartnerController.php プロジェクト: xindalu/evolve
 /**
  * 根据业务伙伴ID获取联系方式列表
  */
 public function getcontactAction()
 {
     $data = array();
     $request = $this->getRequest()->getParams();
     $option = isset($request['option']) ? $request['option'] : 'data';
     $partner_id = isset($request['partner_id']) ? $request['partner_id'] : 0;
     if ($partner_id > 0) {
         $contact = new Erp_Model_Contact();
         $record = $contact->fetchAll("partner_id = " . $partner_id, 'CONVERT( name USING gbk )')->toArray();
         if ($option == 'list') {
             foreach ($record as $rec) {
                 $active = $rec['active'] == 1 ? true : false;
                 $default = $rec['default'] == 1 ? true : false;
                 array_push($data, array('id' => $rec['id'], 'partner_id' => $rec['partner_id'], 'active' => $active, 'default' => $default, 'name' => $rec['name'], 'post' => $rec['post'], 'tel' => $rec['tel'], 'fax' => $rec['fax'], 'email' => $rec['email'], 'country' => $rec['country'], 'area' => $rec['area'], 'address' => $rec['address'], 'zip_code' => $rec['zip_code'], 'remark' => $rec['remark']));
             }
         } else {
             foreach ($record as $rec) {
                 $active = $rec['active'] == 1 ? true : false;
                 $default = $rec['default'] == 1 ? true : false;
                 array_push($data, array('contact_id' => $rec['id'], 'contact_partner_id' => $rec['partner_id'], 'contact_active' => $active, 'contact_default' => $default, 'contact_name' => $rec['name'], 'contact_post' => $rec['post'], 'contact_tel' => $rec['tel'], 'contact_fax' => $rec['fax'], 'contact_email' => $rec['email'], 'contact_country' => $rec['country'], 'contact_area' => $rec['area'], 'contact_area_city' => $rec['area_city'], 'contact_area_code' => $rec['area_code'], 'contact_person_liable' => $rec['person_liable'], 'contact_address' => $rec['address'], 'contact_zip_code' => $rec['zip_code'], 'contact_remark' => $rec['remark']));
             }
         }
     }
     echo Zend_Json::encode($data);
     exit;
 }
コード例 #6
0
ファイル: OrderController.php プロジェクト: xindalu/evolve
 public function getprintAction()
 {
     $result = array('success' => true, 'info' => '');
     $request = $this->getRequest()->getParams();
     if (isset($request['id']) && isset($request['tpl_id'])) {
         $helper = new Application_Model_Helpers();
         $order = new Erp_Model_Sale_Order();
         $orderData = $order->getData(null, $request['id']);
         $items = new Erp_Model_Sale_Orderitems();
         $itemsData = $items->getData($request['id']);
         $currency = new Erp_Model_Setting_Currency();
         $currencyData = $currency->getInfoByCode($orderData['currency']);
         $contactModel = new Erp_Model_Contact();
         $contactData = $contactModel->getDataByCode($orderData['customer_address_code']);
         $tpl = new Erp_Model_Tpl();
         $tplHtmlData = $tpl->fetchRow("id = " . $request['tpl_id'])->toArray();
         $tplHtml = $tplHtmlData['html'];
         $itemsHtml = '';
         if ($request['tpl_id'] == 16) {
             $i = 0;
             foreach ($itemsData as $item) {
                 $i++;
                 $itemsHtml .= '
                 <tr>
                     <td>' . $i . '</td>
                     <td>' . $item['items_code'] . '</td>
                     <td>' . $item['items_description'] . '</td>
                     <td>' . $item['items_qty'] . '</td>
                     <td>' . $currencyData['symbol'] . number_format($item['items_price'], 4) . '</td>
                     <td>' . $currencyData['symbol'] . $item['items_total'] . '</td>
                     <td>' . $item['items_remark'] . '</td>
                 </tr>';
             }
         } else {
             foreach ($itemsData as $item) {
                 $itemsHtml .= '
                 <tr>
                     <td>' . $item['items_customer_code'] . '</td>
                     <td>' . $item['items_code'] . '</td>
                     <td>' . $item['items_description'] . '</td>
                     <td>' . $item['items_qty'] . '</td>
                     <td>' . $currencyData['symbol'] . number_format($item['items_price'], 4) . '</td>
                     <td>' . $currencyData['symbol'] . $item['items_total'] . '</td>
                 </tr>';
             }
         }
         $rate = $orderData['tax_rate'] * 100;
         $total_lower = $orderData['currency_rate'] != 1 ? $orderData['forein_total'] : $orderData['total'];
         $orderInfo = array('company_logo' => HOME_PATH . '/public/images/company.png', 'order_address' => '成都', 'order_number' => $orderData['number'], 'order_date' => $orderData['order_date'], 'order_remark' => $orderData['remark'], 'tax_name' => $orderData['tax_name'] . '( ' . $rate . '% )', 'total_upper' => $helper->num2rmb($orderData['total']), 'total_lower' => $currencyData['symbol'] . $total_lower, 'company_name' => '成都欧飞凌通讯技术有限公司', 'company_name_en' => 'OPhylink Communication Technology Inc.', 'customer_cname' => $orderData['customer_cname'], 'customer_ename' => $orderData['customer_ename'], 'company_tel' => '028-85161178', 'company_fax' => '028-85161176', 'company_address' => '四川成都高新区云华路333号1幢-5A座3层', 'company_bank' => '招商银行成都分行高新支行', 'company_account' => '128904731510811', 'company_tax' => '510198698882411', 'customer_tel' => $contactData['tel'], 'customer_fax' => $contactData['fax'], 'customer_address' => $contactData['address'], 'customer_bank' => $orderData['customer_bank_type'], 'customer_account' => $orderData['customer_bank_account'], 'customer_tax' => $orderData['customer_tax_num'], 'customer_payment_days' => $orderData['customer_bank_payment_days'], 'items' => $itemsHtml);
         //echo '<pre>';print_r($orderInfo);exit;
         foreach ($orderInfo as $key => $val) {
             $tplHtml = str_replace('<tpl_' . $key . '>', $val, $tplHtml);
         }
         $result['info'] = $tplHtml;
     } else {
         $result['success'] = false;
     }
     /* echo $tplHtml;
        exit; */
     echo Zend_Json::encode($result);
     exit;
 }