|  | @@ -535,7 +535,7 @@ class fjHelper {
 | 
	
		
			
				|  |  |          this.ctx.helper.assignRelaData(billsData, [
 | 
	
		
			
				|  |  |              { data: curStage, fields: ['qc_qty', 'qc_tp', 'qc_minus_qty'], prefix: '', relaId: 'lid' },
 | 
	
		
			
				|  |  |              { data: preStage, fields: ['qc_qty', 'qc_tp', 'qc_minus_qty'], prefix: 'pre_', relaId: 'lid' },
 | 
	
		
			
				|  |  | -            { data: bpcStage, fields: ['contract_pc_tp', 'qc_pc_tp', 'pc_tp'], prefix: '', relaId: 'lid' },
 | 
	
		
			
				|  |  | +            { data: bpcStage, fields: ['contract_pc_tp', 'qc_pc_tp', 'pc_tp', 'org_price'], prefix: '', relaId: 'lid' },
 | 
	
		
			
				|  |  |          ]);
 | 
	
		
			
				|  |  |          billsData.forEach(node => {
 | 
	
		
			
				|  |  |              node.end_qc_qty = helper.add(node.pre_qc_qty, node.qc_qty);
 | 
	
	
		
			
				|  | @@ -610,7 +610,7 @@ class fjHelper {
 | 
	
		
			
				|  |  |              if (!sb.b_code) continue;
 | 
	
		
			
				|  |  |              let b = bills.find(x => { return x.b_code === sb.b_code && x.name === sb.name && x.unit === sb.unit && x.unit_price === sb.unit_price; });
 | 
	
		
			
				|  |  |              if (!b) {
 | 
	
		
			
				|  |  | -                b = { b_code: sb.b_code, name: sb.name, unit: sb.unit, unit_price: sb.unit_price, ledgerSource: [] };
 | 
	
		
			
				|  |  | +                b = { b_code: sb.b_code, name: sb.name, unit: sb.unit, unit_price: sb.unit_price, org_price: sb.org_price, ledgerSource: [] };
 | 
	
		
			
				|  |  |                  bills.push(b);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              const ls = b.ledgerSource.find(x => { return x.lid === sb.lid; });
 | 
	
	
		
			
				|  | @@ -636,19 +636,28 @@ class fjHelper {
 | 
	
		
			
				|  |  |              b.total_price = helper.sum(b.ledgerSource.map(x => { return x.total_price; }));
 | 
	
		
			
				|  |  |              b.final_qty = helper.sum(b.ledgerSource.map(x => { return x.final_qty; }));
 | 
	
		
			
				|  |  |              b.final_tp = helper.sum(b.ledgerSource.map(x => { return x.final_tp; }));
 | 
	
		
			
				|  |  | -            b.pre_positive_qc_tp = helper.mul(b.unit_price, b.pre_positive_qc_qty, tpDecimal);
 | 
	
		
			
				|  |  | -            b.pre_negative_qc_tp = helper.mul(b.unit_price, b.pre_negative_qc_qty, tpDecimal);
 | 
	
		
			
				|  |  | +            if (b.org_price) {
 | 
	
		
			
				|  |  | +                b.pre_positive_qc_tp = helper.mul(b.org_price, b.pre_positive_qc_qty, tpDecimal);
 | 
	
		
			
				|  |  | +                b.pre_negative_qc_tp = helper.mul(b.org_price, b.pre_negative_qc_qty, tpDecimal);
 | 
	
		
			
				|  |  | +                b.positive_qc_pc_tp = helper.sub(helper.mul(b.unit_price, b.pre_positive_qc_qty, tpDecimal), b.pre_positive_qc_tp);
 | 
	
		
			
				|  |  | +                b.negative_qc_pc_tp = helper.sub(helper.mul(b.unit_price, b.pre_negative_qc_qty, tpDecimal), b.pre_negative_qc_tp);
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                b.pre_positive_qc_tp = helper.mul(b.unit_price, b.pre_positive_qc_qty, tpDecimal);
 | 
	
		
			
				|  |  | +                b.pre_negative_qc_tp = helper.mul(b.unit_price, b.pre_negative_qc_qty, tpDecimal);
 | 
	
		
			
				|  |  | +                b.positive_qc_pc_tp = 0;
 | 
	
		
			
				|  |  | +                b.negative_qc_pc_tp = 0;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              b.positive_qc_tp = helper.mul(b.unit_price, b.positive_qc_qty, tpDecimal);
 | 
	
		
			
				|  |  |              b.negative_qc_tp = helper.mul(b.unit_price, b.negative_qc_qty, tpDecimal);
 | 
	
		
			
				|  |  |              b.end_positive_qc_qty = helper.add(b.pre_positive_qc_qty, b.positive_qc_qty);
 | 
	
		
			
				|  |  | -            b.end_positive_qc_tp = helper.add(b.pre_positive_qc_tp, b.positive_qc_tp);
 | 
	
		
			
				|  |  | +            b.end_positive_qc_tp = helper.add(helper.add(b.pre_positive_qc_tp, b.positive_qc_tp), b.positive_qc_pc_tp);
 | 
	
		
			
				|  |  |              b.end_negative_qc_qty = helper.add(b.pre_negative_qc_qty, b.negative_qc_qty);
 | 
	
		
			
				|  |  | -            b.end_negative_qc_tp = helper.add(b.pre_negative_qc_tp, b.negative_qc_tp);
 | 
	
		
			
				|  |  | +            b.end_negative_qc_tp = helper.add(helper.add(b.pre_negative_qc_tp, b.negative_qc_tp), b.negative_qc_pc_tp);
 | 
	
		
			
				|  |  |              result.push({
 | 
	
		
			
				|  |  |                  b_code: b.b_code, name: b.name, unit: b.unit, unit_price: b.unit_price,
 | 
	
		
			
				|  |  |                  quantity: b.quantity, total_price: b.total_price,
 | 
	
		
			
				|  |  |                  pre_qc_qty: b.pre_positive_qc_qty, pre_qc_tp: b.pre_positive_qc_tp,
 | 
	
		
			
				|  |  | -                qc_qty: b.positive_qc_qty, qc_tp: b.positive_qc_tp,
 | 
	
		
			
				|  |  | +                qc_qty: b.positive_qc_qty, qc_tp: b.positive_qc_tp, qc_pc_tp: b.positive_qc_pc_tp,
 | 
	
		
			
				|  |  |                  end_qc_qty: b.end_positive_qc_qty, end_qc_tp: b.end_positive_qc_tp,
 | 
	
		
			
				|  |  |                  final_qty: b.final_qty, final_tp: b.final_tp,
 | 
	
		
			
				|  |  |                  minus: 0,
 | 
	
	
		
			
				|  | @@ -657,7 +666,7 @@ class fjHelper {
 | 
	
		
			
				|  |  |                  b_code: b.b_code, name: b.name, unit: b.unit, unit_price: b.unit_price,
 | 
	
		
			
				|  |  |                  quantity: b.quantity, total_price: b.total_price,
 | 
	
		
			
				|  |  |                  pre_qc_qty: b.pre_negative_qc_qty, pre_qc_tp: b.pre_negative_qc_tp,
 | 
	
		
			
				|  |  | -                qc_qty: b.negative_qc_qty, qc_tp: b.negative_qc_tp,
 | 
	
		
			
				|  |  | +                qc_qty: b.negative_qc_qty, qc_tp: b.negative_qc_tp, qc_pc_tp: b.negative_qc_pc_tp,
 | 
	
		
			
				|  |  |                  end_qc_qty: b.end_negative_qc_qty, end_qc_tp: b.end_negative_qc_tp,
 | 
	
		
			
				|  |  |                  final_qty: b.final_qty, final_tp: b.final_tp,
 | 
	
		
			
				|  |  |                  minus: 1,
 |