Invalid argument is what problem
Procedure TPayApplyHeadForm. BtnAddItemClick (Sender: TObject);
{the begin
Inherited;
DgDetail. RowProps [dgDetail. Row]. Checked:=true;
end; }
Var
Item: TPay_Apply_Head;
IRow, I: Integer;
Amount: Double;
The begin
Item:=TPay_Apply_Head. Create;
Item. Search_Flag:=6;//query parameters corresponding material
Msgbox (' 1111111111 ');
Try
If CommonSearchObj (TBizObject (Item), ' ') then
The begin
Msgbox (' QQQQQQQ ');
IRow:=dgDetail. GetFirstEmptyRow;
If iRow=1 then
The begin
Msgbox (' uuuuuuu ');
DgDetail. RowCount:=dgDetail. RowCount + 1;
IRow:=dgDetail. RowCount - 1;
end;
If (Item. Pay_type='quality retention money) then
The begin
Msgbox (' yyyyyy);
For I:=1 to dgDetail. Do the RowCount - 1
The begin
Msgbox (' eeeeeeeee ');
If not dgDetail. RowProps [I]. Checked then
The begin
Msgbox (' PPPPPP ');
The Continue;
end;
If (dgDetail. CellByField2 [' pay_type ', I]='monthly statement') or (dgDetail. CellByField2 [' pay_type ', I]='advance payment')
Or (dgDetail. CellByField2 [' pay_type ', I]='back') then
Amount:=Amount + StrToFloatDef (dgDetail CellByField2 [' Pay_Amount ', I], 0).
end;
Amount: Amount=1 * * strtofloatdef (BedtASSURE_PERCENTAGE. Text, 0)/100;
DgDetail. CellByField2 [' Pay_Amount iRow] :=Format (' % 0.2 f '[Amount]);
DgDetail. CellLocked [dgDetail GetFieldIndex (' Pay_Amount), irow] :=true;
end;
If ((Item. Pay_type='orders the difference') or (Item. Pay_type='no carton)) then
The begin
Msgbox (" NNNNNNNNN ");
DgDetail. CellLocked [dgDetail GetFieldIndex (' item_code), iRow] :=False;
DgDetail. Columns [dgDetail GetFieldIndex (' item_code)], ReadOnly:=False;
end;
DgDetail. CellByField2 [' source_id, iRow] :=IntToStr (Item. Pay_Apply_Head_Id);
DgDetail. CellByField2 [' bill_no iRow] :=Item. Bill_no;
DgDetail. CellByField2 [' date_invbill iRow] :=Item. Date_invbill;
DgDetail. CellByField2 [' pay_type iRow] :=Item. Pay_type;
DgDetail. CellByField2 [' source_line_id iRow] :=IntToStr (Item. Pay_apply_line_id);
//dgDetail CellLocked [dgDetail GetFieldIndex (' Qty_Match), iRow] :=True;
//dgDetail CellLocked [dgDetail GetFieldIndex (' Price_NoTax_Fact), iRow] :=True;
DgDetail. CellLocked [dgDetail GetFieldIndex (' pay_qty), iRow] :=true;
DgDetail. CellLocked [dgDetail GetFieldIndex (' Pay_Percent), iRow] :=true;
Checked dgDetail. RowProps [iRow]=True;
DgDetail. CellByField2 [' Pay_Type_Id iRow] :=IntToStr (Item. Pay_Type_Id);
end;
The finally
Msgbox (' MMMMMMMMMMM ');
Item. The Free;
end;
end;