| 
					
				 | 
			
			
				@@ -8,18 +8,18 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          b.colour as colour,b.size as size,b.coding_rules as codingRules,sum(b.quantity) as quantity,a.business_type_value as businessTypeText,a.customer_order_number as customerOrderNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            a.sales_type_text as salesTypeText,a.customer_abbreviation as customerAbbreviation,a.customer_name as customerName,sum(b.surplus_num) as surplusNum,DATE_FORMAT(b.pre_completion_date,'%Y-%m-%d') as preCompletionDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            a.brand_side as brandSide,a.exchange_rate as exchangeRate,b.specification_and_model as specificationAndModel,a.account as account,b.inventory_code as inventoryCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           b.distribution_point as distributionPoint,b.pack_id as packId,a.supplier as supplier,b.unit_price_including_tax as unitPriceIncludingTax, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           b.distribution_point as distributionPoint,b.pack_id as packId,b.unit_price_including_tax as unitPriceIncludingTax, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            b.supplier_code as supplierCode,a.garment_nmb as garmentNmb,a.garment_factory as garmentFactory,DATE_FORMAT(b.pre_delivery_date,'%Y-%m-%d') as preDeliveryDate,b.box_number as boxNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            a.whole_order_total as wholeOrderTotal,a.sales_department as salesDepartment,a.salesman as salesman,a.currency_text as currencyText,a.third_party as thirdParty, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             a.deposit_ratio as depositRatio,a.deposit as deposit,a.collaborative_route as collaborativeRoute,a.term_of_payment as termOfPayment,a.end_customer as endCustomer, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             a.order_remarks as orderRemarks,a.price_remarks as priceRemarks,a.order_change_description as orderChangeDescription,b.supplier as supplier,b.iTaxPrice as iTaxPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             case when b.ymoney is null then '0' else b.ymoney end as ymoney,b.OMPO_id as OMPOId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             a.order_remarks as orderRemarks,a.price_remarks as priceRemarks,a.order_change_description as orderChangeDescription,b.supplier as supplier,b.i_tax_price as iTaxPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             case when b.ymoney is null then '0' else b.ymoney end as ymoney,b.OMPO_id as OMPOId,b.inventory_ccode as inventoryCcode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              from sy_order_data_item b 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         left join sy_order_data a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         on a.id = b.sy_order_data_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ${ew.customSqlSegment} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            AND (b.inventory_code like '19%' or b.inventory_code like 'N19%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND (b.inventory_ccode like '19%' or b.inventory_code like 'N19%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         group by concat(a.order_number,a.customer_abbreviation,a.sales_department,a.salesman,a.account,b.pre_delivery_date,a.order_remarks, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         b.item_number,b.small_po,b.inventory_name,b.colour,b.distribution_point,b.pack_id,b.coding_rules) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -33,17 +33,17 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          b.colour as colour,b.size as size,b.coding_rules as codingRules,sum(b.quantity) as quantity,a.business_type_value as businessTypeText,a.customer_order_number as customerOrderNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            a.sales_type_text as salesTypeText,a.customer_abbreviation as customerAbbreviation,a.customer_name as customerName,sum(b.surplus_num) as surplusNum,DATE_FORMAT(b.pre_completion_date,'%Y-%m-%d') as preCompletionDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            a.brand_side as brandSide,a.exchange_rate as exchangeRate,b.specification_and_model as specificationAndModel,a.account as account,b.inventory_code as inventoryCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           b.distribution_point as distributionPoint,b.pack_id as packId,a.supplier as supplier,b.unit_price_including_tax as unitPriceIncludingTax, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           b.distribution_point as distributionPoint,b.pack_id as packId,b.unit_price_including_tax as unitPriceIncludingTax, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            b.supplier_code as supplierCode,a.garment_nmb as garmentNmb,a.garment_factory as garmentFactory,DATE_FORMAT(b.pre_delivery_date,'%Y-%m-%d') as preDeliveryDate,b.box_number as boxNumber, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            a.whole_order_total as wholeOrderTotal,a.sales_department as salesDepartment,a.salesman as salesman,a.currency_text as currencyText,a.third_party as thirdParty, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             a.deposit_ratio as depositRatio,a.deposit as deposit,a.collaborative_route as collaborativeRoute,a.term_of_payment as termOfPayment,a.end_customer as endCustomer, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             a.order_remarks as orderRemarks,a.price_remarks as priceRemarks,a.order_change_description as orderChangeDescription,b.supplier as supplier,b.iTaxPrice as iTaxPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             case when b.ymoney is null then '0' else b.ymoney end as ymoney,b.OMPO_id as OMPOId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             a.order_remarks as orderRemarks,a.price_remarks as priceRemarks,a.order_change_description as orderChangeDescription,b.supplier as supplier,b.i_tax_price as iTaxPrice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             case when b.ymoney is null then '0' else b.ymoney end as ymoney,b.OMPO_id as OMPOId,b.inventory_ccode as inventoryCcode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         from sy_order_data_item b 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         left join sy_order_data a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         on a.id = b.sy_order_data_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ${ew.customSqlSegment} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            AND (b.inventory_code not like '19%' and b.inventory_code not like 'N19%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND (b.inventory_ccode not like '19%' and b.inventory_code not like 'N19%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          group by concat(a.order_number,a.customer_abbreviation,a.sales_department,a.salesman,a.account,b.pre_delivery_date,a.order_remarks, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         b.item_number,b.small_po,b.inventory_name,b.colour,b.distribution_point,b.pack_id,b.coding_rules) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -67,7 +67,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 left join sy_shipping_details_item b 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 on a.id = b.shipping_details_id and b.del_flag = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 where a.del_flag = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  AND (b.inventory_code like '19%' or b.inventory_code like 'N19%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND (b.inventory_ccode like '19%' or b.inventory_code like 'N19%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 GROUP BY a.document_no, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 b.order_number,b.customer_abbreviation,b.sales_department,b.salesman,a.account,b.pre_delivery_date,b.order_remarks, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -95,7 +95,7 @@ ${ew.customSqlSegment} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 left join sy_shipping_details_item b 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 on a.id = b.shipping_details_id and b.del_flag = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 where a.del_flag = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  AND (b.inventory_code not like '19%' and b.inventory_code not like 'N19%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND (b.inventory_ccode not like '19%' and b.inventory_code not like 'N19%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  order by a.document_no desc) as t 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ${ew.customSqlSegment} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |