|  | @@ -84,6 +84,17 @@ uses
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  {$R *.dfm}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +const
 | 
	
		
			
				|  |  | +  iBwNameCol = 1;
 | 
	
		
			
				|  |  | +  iBwDrawingCodeCol = 2;
 | 
	
		
			
				|  |  | +  iBwBillsQtyCol = 3;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  iGclCodeCol = 1;
 | 
	
		
			
				|  |  | +  iGclNameCol = 2;
 | 
	
		
			
				|  |  | +  iGclUnitsCol = 3;
 | 
	
		
			
				|  |  | +  iGclPriceCol = 4;
 | 
	
		
			
				|  |  | +  iGclDrawingCodeCol = 5;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  procedure AddLeafBills(ABillsCompileData: TBillsCompileData; AInsertType: TInsertType);
 | 
	
		
			
				|  |  |  var
 | 
	
		
			
				|  |  |    InsertBillsForm: TBatchInsertBillsForm;
 | 
	
	
		
			
				|  | @@ -110,8 +121,8 @@ begin
 | 
	
		
			
				|  |  |    with stnNode.Rec do
 | 
	
		
			
				|  |  |    begin
 | 
	
		
			
				|  |  |      ValueByName('Code').AsString := GetXmjCode(ARow);{ReplaceLastNum(leBeginCode.Text, ARow);}
 | 
	
		
			
				|  |  | -    ValueByName('Name').AsString := zgPosition.Cells[1, ARow].Text;
 | 
	
		
			
				|  |  | -    ValueByName('DrawingCode').AsString := leDrawingCode.Text;
 | 
	
		
			
				|  |  | +    ValueByName('Name').AsString := zgPosition.Cells[iBwNameCol, ARow].Text;
 | 
	
		
			
				|  |  | +    ValueByName('DrawingCode').AsString := zgPosition.Cells[iBwDrawingCodeCol, ARow].Text;
 | 
	
		
			
				|  |  |    end;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    AddBillsNodes(ARow, stnNode);
 | 
	
	
		
			
				|  | @@ -193,13 +204,16 @@ end;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  procedure TBatchInsertBillsForm.ResetPositionGridHead;
 | 
	
		
			
				|  |  |  var
 | 
	
		
			
				|  |  | -  iCol: Integer;
 | 
	
		
			
				|  |  | +  iCol, iColDiff: Integer;
 | 
	
		
			
				|  |  |  begin
 | 
	
		
			
				|  |  | -  zgPosition.Cells[1, 0].Text := '窒弇';
 | 
	
		
			
				|  |  | -  zgPosition.ColWidths[1] := 120;
 | 
	
		
			
				|  |  | -  for iCol := 2 to zgPosition.ColCount - 1 do
 | 
	
		
			
				|  |  | +  zgPosition.Cells[iBwNameCol, 0].Text := '窒弇';
 | 
	
		
			
				|  |  | +  zgPosition.ColWidths[iBwNameCol] := 100;
 | 
	
		
			
				|  |  | +  zgPosition.Cells[iBwDrawingCodeCol, 0].Text := '芞(聊)瘍';
 | 
	
		
			
				|  |  | +  zgPosition.ColWidths[iBwDrawingCodeCol] := 100;
 | 
	
		
			
				|  |  | +  iColDiff := iBwBillsQtyCol - 1;
 | 
	
		
			
				|  |  | +  for iCol := iBwBillsQtyCol to zgPosition.ColCount - 1 do
 | 
	
		
			
				|  |  |    begin
 | 
	
		
			
				|  |  | -    zgPosition.Cells[iCol, 0].Text := 'ラ等' + IntToStr(iCol - 1);
 | 
	
		
			
				|  |  | +    zgPosition.Cells[iCol, 0].Text := 'ラ等' + IntToStr(iCol - iColDiff);
 | 
	
		
			
				|  |  |      zgPosition.ColWidths[iCol] := 50;
 | 
	
		
			
				|  |  |    end;
 | 
	
		
			
				|  |  |  end;
 | 
	
	
		
			
				|  | @@ -247,17 +261,17 @@ var
 | 
	
		
			
				|  |  |  begin
 | 
	
		
			
				|  |  |    if (zgBills.Cells[1, ARow].Text = '') or
 | 
	
		
			
				|  |  |       (zgPosition.Cells[ARow + 1, AQtyRow].Text = '') or
 | 
	
		
			
				|  |  | -     not TryStrToFloat(zgPosition.Cells[ARow + 1, AQtyRow].Text, fQuantity) then Exit;
 | 
	
		
			
				|  |  | +     not TryStrToFloat(zgPosition.Cells[ARow + iBwBillsQtyCol - 1, AQtyRow].Text, fQuantity) then Exit;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    stnNode := FBillsCompileData.BillsCompileTree.Add(AParent.ID, -1);
 | 
	
		
			
				|  |  |    with stnNode.Rec do
 | 
	
		
			
				|  |  |    begin
 | 
	
		
			
				|  |  | -    ValueByName('B_Code').AsString := zgBills.Cells[1, ARow].Text;
 | 
	
		
			
				|  |  | -    ValueByName('Name').AsString := zgBills.Cells[2, ARow].Text;
 | 
	
		
			
				|  |  | -    ValueByName('Units').AsString := zgBills.Cells[3, ARow].Text;
 | 
	
		
			
				|  |  | -    ValueByName('Price').AsFloat := StrToFloatDef(zgBills.Cells[4, ARow].Text, 0);
 | 
	
		
			
				|  |  | -    ValueByName('OrgQuantity').AsFloat := StrToFloatDef(zgPosition.Cells[ARow + 1, AQtyRow].Text, 0);
 | 
	
		
			
				|  |  | -    ValueByName('DrawingCode').AsString := zgBills.Cells[5, ARow].Text;
 | 
	
		
			
				|  |  | +    ValueByName('B_Code').AsString := zgBills.Cells[iGclCodeCol, ARow].Text;
 | 
	
		
			
				|  |  | +    ValueByName('Name').AsString := zgBills.Cells[iGclNameCol, ARow].Text;
 | 
	
		
			
				|  |  | +    ValueByName('Units').AsString := zgBills.Cells[iGclUnitsCol, ARow].Text;
 | 
	
		
			
				|  |  | +    ValueByName('Price').AsFloat := StrToFloatDef(zgBills.Cells[iGclPriceCol, ARow].Text, 0);
 | 
	
		
			
				|  |  | +    ValueByName('OrgQuantity').AsFloat := StrToFloatDef(zgPosition.Cells[ARow + iBwBillsQtyCol - 1, AQtyRow].Text, 0);
 | 
	
		
			
				|  |  | +    ValueByName('DrawingCode').AsString := zgBills.Cells[iGclDrawingCodeCol, ARow].Text;
 | 
	
		
			
				|  |  |    end;
 | 
	
		
			
				|  |  |  end;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -265,15 +279,15 @@ procedure TBatchInsertBillsForm.ResetBillsGridHead;
 | 
	
		
			
				|  |  |  var
 | 
	
		
			
				|  |  |    iRow: Integer;
 | 
	
		
			
				|  |  |  begin
 | 
	
		
			
				|  |  | -  zgBills.Cells[1, 0].Text := '晤瘍';
 | 
	
		
			
				|  |  | +  zgBills.Cells[iGclCodeCol, 0].Text := '晤瘍';
 | 
	
		
			
				|  |  |    zgBills.ColWidths[1] := 80;
 | 
	
		
			
				|  |  | -  zgBills.Cells[2, 0].Text := '靡備';
 | 
	
		
			
				|  |  | +  zgBills.Cells[iGclNameCol, 0].Text := '靡備';
 | 
	
		
			
				|  |  |    zgBills.ColWidths[2] := 120;
 | 
	
		
			
				|  |  | -  zgBills.Cells[3, 0].Text := '等弇';
 | 
	
		
			
				|  |  | +  zgBills.Cells[iGclUnitsCol, 0].Text := '等弇';
 | 
	
		
			
				|  |  |    zgBills.ColWidths[3] := 60;
 | 
	
		
			
				|  |  | -  zgBills.Cells[4, 0].Text := '等歎';
 | 
	
		
			
				|  |  | +  zgBills.Cells[iGclPriceCol, 0].Text := '等歎';
 | 
	
		
			
				|  |  |    zgBills.ColWidths[4] := 60;
 | 
	
		
			
				|  |  | -  zgBills.Cells[5, 0].Text := '芞(聊)瘍';
 | 
	
		
			
				|  |  | +  zgBills.Cells[iGclDrawingCodeCol, 0].Text := '芞(聊)瘍';
 | 
	
		
			
				|  |  |    zgBills.ColWidths[5] := 60;
 | 
	
		
			
				|  |  |    for iRow := 1 to zgBills.RowCount - 1 do
 | 
	
		
			
				|  |  |      zgBills.Cells[0, iRow].Text := 'ラ等' + IntToStr(iRow);
 | 
	
	
		
			
				|  | @@ -345,23 +359,23 @@ begin
 | 
	
		
			
				|  |  |        Rec := sddBills.Locate('B_Code', sB_Code);
 | 
	
		
			
				|  |  |      if Assigned(Rec) then
 | 
	
		
			
				|  |  |      begin
 | 
	
		
			
				|  |  | -      zgBills.Cells[2, Row].Text := Rec.ValueByName('Name').AsString;
 | 
	
		
			
				|  |  | -      zgBills.Cells[2, Row].Align := gaCenterLeft;
 | 
	
		
			
				|  |  | -      zgBills.Cells[3, Row].Text := Rec.ValueByName('Units').AsString;
 | 
	
		
			
				|  |  | -      zgBills.Cells[3, Row].Align := gaCenterCenter;
 | 
	
		
			
				|  |  | -      zgBills.Cells[3, Row].Font.Name := 'smartSimSun';
 | 
	
		
			
				|  |  | -      zgBills.Cells[4, Row].Text := Rec.ValueByName('Price').AsString;
 | 
	
		
			
				|  |  | -      zgBills.Cells[4, Row].Align := gaCenterRight;
 | 
	
		
			
				|  |  | -      zgBills.Cells[5, Row].Align := gaCenterLeft;
 | 
	
		
			
				|  |  | +      zgBills.Cells[iGclNameCol, Row].Text := Rec.ValueByName('Name').AsString;
 | 
	
		
			
				|  |  | +      zgBills.Cells[iGclNameCol, Row].Align := gaCenterLeft;
 | 
	
		
			
				|  |  | +      zgBills.Cells[iGclUnitsCol, Row].Text := Rec.ValueByName('Units').AsString;
 | 
	
		
			
				|  |  | +      zgBills.Cells[iGclUnitsCol, Row].Align := gaCenterCenter;
 | 
	
		
			
				|  |  | +      zgBills.Cells[iGclPriceCol, Row].Font.Name := 'smartSimSun';
 | 
	
		
			
				|  |  | +      zgBills.Cells[iGclPriceCol, Row].Text := Rec.ValueByName('Price').AsString;
 | 
	
		
			
				|  |  | +      zgBills.Cells[iGclPriceCol, Row].Align := gaCenterRight;
 | 
	
		
			
				|  |  | +      zgBills.Cells[iGclDrawingCodeCol, Row].Align := gaCenterLeft;
 | 
	
		
			
				|  |  |      end;
 | 
	
		
			
				|  |  |    end
 | 
	
		
			
				|  |  | -  else if (Col = 4) and (Row > 0) then
 | 
	
		
			
				|  |  | +  else if (Col = iGclPriceCol) and (Row > 0) then
 | 
	
		
			
				|  |  |    begin
 | 
	
		
			
				|  |  |      zgBills.Cells[Col, Row].Value := PriceRoundTo(
 | 
	
		
			
				|  |  |          StrToFloatDef(zgBills.Cells[Col, Row].Text, 0));
 | 
	
		
			
				|  |  |      zgBills.Cells[Col, Row].Align := gaCenterRight;
 | 
	
		
			
				|  |  |    end
 | 
	
		
			
				|  |  | -  else if (Col = 5) and (Row > 0) then
 | 
	
		
			
				|  |  | +  else if (Col = iGclDrawingCodeCol) and (Row > 0) then
 | 
	
		
			
				|  |  |      zgBills.Cells[Col, Row].Align := gaCenterLeft;
 | 
	
		
			
				|  |  |  end;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -405,7 +419,7 @@ procedure TBatchInsertBillsForm.zgPositionCellTextChanged(Sender: TObject;
 | 
	
		
			
				|  |  |  var
 | 
	
		
			
				|  |  |    value: Double;
 | 
	
		
			
				|  |  |  begin
 | 
	
		
			
				|  |  | -  if (Col > 1) and (Row > 0) then
 | 
	
		
			
				|  |  | +  if (Col >= iBwBillsQtyCol) and (Row > 0) then
 | 
	
		
			
				|  |  |    begin
 | 
	
		
			
				|  |  |      if (TryStrToFloat(zgPosition.Cells[Col, Row].Text, value)) then
 | 
	
		
			
				|  |  |      begin
 | 
	
	
		
			
				|  | @@ -425,9 +439,10 @@ end;
 | 
	
		
			
				|  |  |  procedure TBatchInsertBillsForm.actnInsertColExecute(Sender: TObject);
 | 
	
		
			
				|  |  |  begin
 | 
	
		
			
				|  |  |    zgPosition.ColCount := zgPosition.ColCount + 1;
 | 
	
		
			
				|  |  | -  zgPosition.Cells[zgPosition.ColCount-1, 0].Text := 'ラ等' + IntToStr(zgPosition.ColCount -1 - 1);
 | 
	
		
			
				|  |  | +  zgPosition.Cells[zgPosition.ColCount-1, 0].Text := 'ラ等' + IntToStr(zgPosition.ColCount - iBwBillsQtyCol);
 | 
	
		
			
				|  |  |    zgPosition.ColWidths[zgPosition.ColCount-1] := 50;
 | 
	
		
			
				|  |  | -  zgBills.RowCount := zgPosition.ColCount - 1;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  zgBills.RowCount := zgPosition.ColCount - (iBwBillsQtyCol - 1);
 | 
	
		
			
				|  |  |    zgBills.Cells[0, zgBills.RowCount-1].Text := 'ラ等' + IntToStr(zgBills.RowCount-1);
 | 
	
		
			
				|  |  |  end;
 | 
	
		
			
				|  |  |  
 |