| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 | 
							- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
 
- class Model_Taxzhengzhou extends Lin_Model 
 
- {
 
- 	function __construct(){
 
- 	parent::__construct();
 
- 	$this->load->database();
 
- 	$this->table = 'taxzhengzhou';
 
-     $this->load_table('tax_zhengzhou');
 
- }
 
-     public function get_ht($ht)
 
- 	{
 
- 		return  $this->find("ht = '$ht'");	
 
- 	}
 
- 	public function get_orderno($orderno)
 
- 	{
 
- 		return  $this->find("orderno = '$orderno'");	
 
- 	}
 
- 	public function get_orders($data)
 
- 	{
 
- 		$xmend = "\n";
 
- 		//需要加密的报文
 
- 		$dataInfo = '<?xml version="1.0" encoding="UTF-8"?>'.$xmend;
 
- 		$dataInfo = '<order>'.$xmend;
 
- 		$dataInfo = '<orderHead>'.$xmend;
 
- 		$dataInfo = '<orderType>'.$data['ordertype'].'</orderType>'.$xmend;//电商平台的订单类型 I-进口商品订单;E-出口商品订单
 
- 		$dataInfo = '<tradeMode>'.$data['trademode'].'</tradeMode>'.$xmend;//一般出口填9610,特殊区域出口填1210
 
- 		$dataInfo = '<statisticsFlag>'.$data['statisticsflag'].'</statisticsFlag>'.$xmend;//A-简化申报.$xmend;B-汇总申报;
 
- 		$dataInfo = '<emsNo>'.$data['emsno'].'</emsNo>'.$xmend;//特殊区域出口模式必须填写具体账号(1210必填)。
 
- 		$dataInfo = '<orderNo>'.$data['orderno'].'</orderNo>'.$xmend;//电商平台的交易订单编号,同一平台的订单编号唯一不重复
 
- 		$dataInfo = '<ebpCode>'.$data['ebpcode'].'</ebpCode>'.$xmend;//电商平台的海关注册登记编号或统一社会信用代码。
 
- 		$dataInfo = '<logisticsCode>'.$data['logisticscode'].'</logisticsCode>'.$xmend;//物流企业的海关注册登记编号或统一社会信用代码。
 
- 		$dataInfo = '<iacCode>'.$data['iaccode'].'</iacCode>'.$xmend;//特殊区域内仓储企业的海关注册登记编号或统一社会信用代码,特殊区域出口模式必填
 
- 		$dataInfo = '<agentCode>'.$data['agentcode'].'</agentCode>'.$xmend;//代理申报企业编号
 
- 		$dataInfo = '<payCode>'.$data['paycode'].'</payCode>'.$xmend;//支付企业的海关编码,国内企业必填。
 
- 		$dataInfo = '<payName>'.$data['payname'].'</payName>'.$xmend;//支付企业名称,非线上支付填"现金支付"
 
- 		$dataInfo = '<ownerCode>'.$data['ownercode'].'</ownerCode>'.$xmend;//生产企业的海关注册登记编号或统一社会信用代码,未在海关登记的填NO
 
- 		$dataInfo = '<ownerName>'.$data['ownername'].'</ownerName>'.$xmend;//生产企业的登记名称
 
- 		$dataInfo = '<preNo>'.$data['preno'].'</preNo>'.$xmend;//电子口岸标识唯一编号(B+8位年月日+9位流水号)
 
- 		$dataInfo = '<licenseNo>'.$data['licenseno'].'</licenseNo>'.$xmend;//商务主管部门及其授权发证机关签发的进出口货物许可证的编号
 
- 		$dataInfo = '<portCode>'.$data['portcode'].'</portCode>'.$xmend;//商品实际出我国关境口岸海关的关区代码 JGS/T 18《海关关区代码》
 
- 		$dataInfo = '<ieDate>'.$data['iedate'].'</ieDate>'.$xmend;//时间格式:YYYYMMDD
 
- 		$dataInfo = '<batchNumber>'.$data['batchnumber'].'</batchNumber>'.$xmend;//商品批次号
 
- 		$dataInfo = '<wrapType>'.$data['wraptype'].'</wrapType>'.$xmend;//海关对进出口货物实际采用的外部包装方式的标识代码,采用1位数字表示,如:木箱、纸箱、桶装、散装、托盘、包、油罐车等
 
- 		$dataInfo = '<packNo>'.$data['packno'].'</packNo>'.$xmend;//件数(包裹数量)
 
- 		$dataInfo = '<grossWeight>'.$data['grossweight'].'</grossWeight>'.$xmend;//货物及其包装材料的重量之和,计量单位为千克
 
- 		$dataInfo = '<netWeight>'.$data['netweight'].'</netWeight>'.$xmend;//货物的毛重减去外包装材料后的重量,即货物本身的实际重量,计量单位为千克
 
- 		$dataInfo = '<goodsValue>'.$data['goodsvalue'].'</goodsValue>'.$xmend;//商品实际成交价FOB(不含运杂费),含非现金抵扣金额
 
- 		$dataInfo = '<discount>'.$data['discount'].'</discount>'.$xmend;//无则填写"0"
 
- 		$dataInfo = '<taxTotal>'.$data['taxtotal'].'</taxTotal>'.$xmend;//按照货款金额计算的税款,无法提供填写"0"
 
- 		$dataInfo = '<charge>'.$data['charge'].'</charge>'.$xmend;//支付企业的订单交易金额
 
- 		$dataInfo = '<freight>'.$data['freight'].'</freight>'.$xmend;//运杂费,无则填写"0"。
 
- 		$dataInfo = '<fFlag>'.$data['fflag'].'</fFlag>'.$xmend;//1-率,2-单价,3-总价
 
- 		$dataInfo = '<insuredFee>'.$data['insuredfee'].'</insuredFee>'.$xmend;//物流企业实际收取的商品保价费用
 
- 		$dataInfo = '<iFlag>'.$data['iflag'].'</iFlag>'.$xmend;//1-率,2-单价,3-总价
 
- 		$dataInfo = '<consigneeName>'.$data['consigneename'].'</consigneeName>'.$xmend;//收货人名称
 
- 		$dataInfo = '<consigneeTel>'.$data['consigneetel'].'</consigneeTel>'.$xmend;//收货人电话
 
- 		$dataInfo = '<consigneeAddress>'.$data['consigneeaddress'].'</consigneeAddress>'.$xmend;//收货人地址
 
- 		$dataInfo = '<trafMode>'.$data['trafmode'].'</trafMode>'.$xmend;//海关标准的参数代码 《JGS-20 海关业务代码集》- 运输方式代码
 
- 		$dataInfo = '<country>'.$data['country'].'</country>'.$xmend;//出口货物的直接运抵的国家(地区),《JGS-20 海关业务代码集》 国家(地区)代码表填写代码。
 
- 		$dataInfo = '<pod>'.$data['pod'].'</pod>'.$xmend;//出口运往境外的最终目的港的标识代码。最终目的港不可预知时,应尽可能按预知的目的港填报
 
- 		$dataInfo = '<logisticsNo>'.$data['logisticsno'].'</logisticsNo>'.$xmend;//物流企业运单的包裹面单号,同一物流企业的运单编号在6个月内不重复。
 
- 		$dataInfo = '<trafName>'.$data['trafname'].'</trafName>'.$xmend;//货物进出境的运输工具的名称或运输工具编号。填报内容应与运输部门向海关申报的载货清单所列相应内容一致。按照关区要求,可以后置申报清单总分单,允许为空。
 
- 		$dataInfo = '<voyageNo>'.$data['voyageno'].'</voyageNo>'.$xmend;//货物进出境的运输工具的航次编号。按照关区要求,可以后置申报清单总分单,允许为空。
 
- 		$dataInfo = '<billNo>'.$data['billno'].'</billNo>'.$xmend;//提单或总运单的编号。按照关区要求,可以后置申报清单总分单,允许为空。
 
- 		$dataInfo = '<totalPackageNo>'.$data['totalpackageno'].'</totalPackageNo>'.$xmend;//对于提运单下含有多个大包的托盘编号(邮件为邮件总包号/邮袋号)。按照关区要求,可以后置申报清单总分单,允许为空。
 
- 		$dataInfo = '<payNo>'.$data['payno'].'</payNo>'.$xmend;//支付交易编号
 
- 		$dataInfo = '<accountingDate>'.$data['accountingdate'].'</accountingDate>'.$xmend;//到账时间 格式:YYYYMMDDhhmmss
 
- 		$dataInfo = '<currencycus>'.$data['currencycus'].'</currencycus>'.$xmend;//海关标准的参数代码 《JGS-20 海关业务代码集》- 货币代码
 
- 		$dataInfo = '<currencyciq>'.$data['currencyciq'].'</currencyciq>'.$xmend;//币制编号,国检标准参数代码-币种
 
- 		$dataInfo = '<note>'.$data['note'].'</note>'.$xmend;
 
- 		$dataInfo = '</orderHead>'.$xmend;
 
- 		$dataInfo = '<orderList>'.$xmend;
 
- 		$dataInfo = '<gnum>'.$data['gnum'].'</gnum>'.$xmend;//从1开始的递增序号(与清单的商品项关联对应)
 
- 		$dataInfo = '<itemNo>'.$data['itemno'].'</itemNo>'.$xmend;//企业自定义的商品货号
 
- 		$dataInfo = '<itemRecordNo>'.$data['itemrecordno'].'</itemRecordNo>'.$xmend;//保税出口模式必填
 
- 		$dataInfo = '<itemName>'.$data['itemname'].'</itemName>'.$xmend;//同一类商品的中文名称。任何一种具体商品可以并只能归入表中的一个条目
 
- 		$dataInfo = '<gcode>'.$data['gcode'].'</gcode>'.$xmend;//对于符合简化申报的商品,前4位按税则归类申报(需要存在相应章节)
 
- 		$dataInfo = '<itemDescribe>'.$data['itemdescribe'].'</itemDescribe>'.$xmend;//电商平台上架的商品描述宣传信息
 
- 		$dataInfo = '<gmodel>'.$data['gmodel'].'</gmodel>'.$xmend;//满足海关归类、审价以及监管的要求为准。包括:品名、牌名、规格、型号、成份、含量、等级等
 
- 		$dataInfo = '<barCode>'.$data['barcode'].'</barCode>'.$xmend;//商品条形码一般由前缀部分、制造厂商代码、商品代码和校验码组成。没有条形码填“无”
 
- 		$dataInfo = '<qty>'.$data['qty'].'</qty>'.$xmend;
 
- 		$dataInfo = '<qty1>'.$data['qty1'].'</qty1>'.$xmend;
 
- 		$dataInfo = '<qty2>'.$data['qty2'].'</qty2>'.$xmend;
 
- 		$dataInfo = '<unitcus>'.$data['unitcus'].'</unitcus>'.$xmend;//海关标准的参数代码 《JGS-20 海关业务代码集》- 计量单位代码
 
- 		$dataInfo = '<unitciq>'.$data['unitciq'].'</unitciq>'.$xmend;//计量单位编号
 
- 		$dataInfo = '<unit1>'.$data['unit1'].'</unit1>'.$xmend;//海关标准的参数代码 《JGS-20 海关业务代码集》- 计量单位代码
 
- 		$dataInfo = '<unit2>'.$data['unit2'].'</unit2>'.$xmend;//海关标准的参数代码 《JGS-20 海关业务代码集》- 计量单位代码
 
- 		$dataInfo = '<price>'.$data['price'].'</price>'.$xmend;//成交单价FOB
 
- 		$dataInfo = '<totalPrice>'.$data['totalprice'].'</totalPrice>'.$xmend;//总价=成交数量*单价
 
- 		$dataInfo = '<currencycus>'.$data['currencycus'].'</currencycus>'.$xmend;//####海关标准的参数代码 海关标准的参数代码 《JGS-20 海关业务代码集》- 货币代码
 
- 		$dataInfo = '<country>'.$data['country'].'</country>'.$xmend;//#####海关标准的参数代码《JGS-20 海关业务代码集》 国家(地区)代码表填写代码。
 
- 		$dataInfo = '<note>'.$data['note'].'</note>'.$xmend;//#####
 
- 		$dataInfo = '</orderList>'.$xmend;
 
- 		$dataInfo = '</order>'.$xmend;
 
- 		
 
- 		$abs_path = './data/caiwu/rsa_public_key.key';
 
-         $content = file_get_contents($abs_path);
 
- 		$key = openssl_pkey_get_public($content);
 
- 		openssl_public_encrypt($dataInfo,$encrypted,$key);
 
- 		$encrypted = base64_encode($encrypted);
 
- 		$byteArray = unpack('C*',$encrypted);  
 
- 		//请求信息
 
- 		$xml = '<?xml version="1.0" encoding="UTF-8"?>'.$xmend;
 
- 		$xml .= '<root>'.$xmend;
 
- 		$xml .= '<pubInfo>'.$xmend;
 
- 		$xml .= '<version>'.$data['version'].'</version>'.$xmend;//Webservice接口版本2.0
 
- 		$xml .= '<companyCode>'.$data['companycode'].'</companyCode>'.$xmend;//电商企业的海关注册登记编号或统一社会信用代码
 
- 		$xml .= '<appType>'.$data['apptype'].'</appType>'.$xmend;//企业报送类型。1-新增 2-变更 3-删除。
 
- 		$xml .= '<appStatus>'.$data['appstatus'].'</appStatus>'.$xmend;//企业报送状态。1-暂存,2-申报。默认申报
 
- 		$xml .= '<signature>'.md5(implode('',$byteArray)).'</signature>'.$xmend;//验证加密报文是否一致
 
- 		$xml .= '<createTime>'.$data['createtime'].'</createTime>'.$xmend;//单据生成日期,格式:YYYYMMDDhhmmss。
 
- 		$xml .= '<customCode>'.$data['customcode'].'</customCode>'.$xmend;//关区代码(郑州保税区4611)
 
- 		$xml .= '</pubInfo>'.$xmend;
 
- 		$xml .= '<dataInfo>'.$encrypted.'</dataInfo>'.$xmend;//订单报文信息加密后内容
 
- 		$xml .= '</root>'.$xmend;
 
- 		$xml = 'xml='.$xml;
 
- 		$ch = curl_init(); 
 
- 		curl_setopt($ch, CURLOPT_URL,'http://emy.hnblc.com:9955/etouch-export/export/order/pushOrder'); 
 
- 		curl_setopt($ch, CURLOPT_POST, 1);
 
- 		curl_setopt($ch, CURLOPT_HEADER, 0);
 
- 		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 
- 		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
 
- 		curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
 
- 		curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
 
- 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
- 		$data = curl_exec($ch);
 
- 		curl_close($ch);
 
- 		//$data = utf8_encode($data);
 
-         libxml_disable_entity_loader(true);
 
-         @$values = json_decode(json_encode(simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
 
- 		return $values;
 
- 	}
 
- 	
 
- 	public function stringToByteArray($str,$charset) {  
 
-   
 
-     $str = iconv($charset,'UTF-16',$str);  
 
-     preg_match_all('/(.)/s',$str,$bytes);  //注:本文的盗版已经有了。不过,提示一下读者,这里的正则改了。  
 
-     $bytes=array_map('ord',$bytes[1]) ;  
 
-     return $bytes;  
 
-   
 
- }  
 
- }  //end class
 
 
  |