Browse Source

Bug #1473 batch insert bills: lose first bills when position's drawing code is null

MaiXinRong 8 years ago
parent
commit
d278835f18
1 changed files with 14 additions and 7 deletions
  1. 14 7
      Forms/BatchInsertBillsFrm.pas

+ 14 - 7
Forms/BatchInsertBillsFrm.pas

@@ -260,7 +260,7 @@ var
   fQuantity: Double;
 begin
   if (zgBills.Cells[1, ARow].Text = '') or
-     (zgPosition.Cells[ARow + 1, AQtyRow].Text = '') or
+     (zgPosition.Cells[ARow + iBwBillsQtyCol - 1, AQtyRow].Text = '') or
      not TryStrToFloat(zgPosition.Cells[ARow + iBwBillsQtyCol - 1, AQtyRow].Text, fQuantity) then Exit;
 
   stnNode := FBillsCompileData.BillsCompileTree.Add(AParent.ID, -1);
@@ -369,6 +369,8 @@ begin
       zgBills.Cells[iGclDrawingCodeCol, Row].Align := gaCenterLeft;
     end;
   end
+  else if (Col = iGclNameCol) and (Row > 0) then
+    zgBills.Cells[iGclNameCol, Row].Align := gaCenterLeft
   else if (Col = iGclPriceCol) and (Row > 0) then
   begin
     zgBills.Cells[Col, Row].Value := PriceRoundTo(
@@ -419,15 +421,20 @@ procedure TBatchInsertBillsForm.zgPositionCellTextChanged(Sender: TObject;
 var
   value: Double;
 begin
-  if (Col >= iBwBillsQtyCol) and (Row > 0) then
+  if (Row > 0) then
   begin
-    if (TryStrToFloat(zgPosition.Cells[Col, Row].Text, value)) then
+    if (Col >= iBwBillsQtyCol) then
     begin
-      zgPosition.Cells[Col, Row].Value := QuantityRoundTo(Value);
-      zgPosition.Cells[Col, Row].Align := gaCenterRight;
+      if (TryStrToFloat(zgPosition.Cells[Col, Row].Text, value)) then
+      begin
+        zgPosition.Cells[Col, Row].Value := QuantityRoundTo(Value);
+        zgPosition.Cells[Col, Row].Align := gaCenterRight;
+      end
+      else
+        zgPosition.Cells[Col, Row].Value := '';
     end
-    else
-      zgPosition.Cells[Col, Row].Value := '';
+    else if (Col > zgPosition.FixedColCount) then
+      zgPosition.Cells[Col, Row].Align := gaCenterLeft;
   end;
 end;