Looks like Dmitry run out support time for the day or questions weren't specific enough. However, If anybody else can and willing to do so, please do.
Her is another try:
With the image below I tried to highlight issues I couldn't resolve:
On frmProduct I have read only Qty in Stock filed. It's calculated value based on purchase and sale invoices tGrids Qty column footer values.
procedure CalculateTotal; //
begin
frmProduct.edProdQtyInStock.Value := frmProduct.tgProdPurchInv.Columns[3].Footer.FormulaValue - frmProduct.tgProdSaleInv.Columns[4].Footer.FormulaValue;
end;
procedure frmProduct_tgProdPurchInv_OnChange (Sender: string);
begin
CalculateTotal;
end;
procedure frmProduct_tgProdSaleInv_OnChange (Sender: string);
begin
CalculateTotal;
end;
ISSUE 1
On Form1 / PageControl1- products tab / tgMainProducts/ Qty in Stock column doesn't display calculated field value of frmProduct / Qty in Stock . I have tried dbUpdate but couldn't get it working:
procedure frmPurchInv_Button1_OnAfterClick (Sender: string);
begin
Form1.tgMainProducts.dbUpdate;
Form1.tgMainPurchInv.dbUpdate;
frmProduct.tgProdPurchInv.dbUpdate;
end;
procedure frmSaleInv_Button1_OnAfterClick (Sender: string);
begin
Form1.tgMainProducts.dbUpdate;
Form1.tgMainSaleInv.dbUpdate;
frmProduct.tgProdSaleInv.dbUpdate;
end;
ISSUE 2
I wanted to display Qty in Stock value from frmProduct inCurrent Stock Level fields on Sale and Purchase Invoice forms according combo item and couldn't:
procedure frmPurchInv_cbPurchInvProduct_OnChange (Sender: string);
begin
frmPurchInv.edPurchInvStockLevel.value := SQLExecute('SELECT qty FROM Product WHERE id='+frmPurchInv.cbPurchInvProduct.sqlValue);
end;
...
ISSUE 3
This one (hiding items on a form onShow) should have been easy. But one item hiding worked OK while second one not?
procedure frmProduct_OnShow (Sender: string; Action: string);
begin
if frmProduct.edProductName.text = '' then
begin
frmProduct.PanInvoices.Visible := False; // Worked OK
frmProduct.panProdQty.Visible := False; // No idea as to why this one is not working?
end else
frmProduct.PanInvoices.Visible := True;
frmProduct.panProdQty.Visible := True;
end;
Updated sample project attached.
Adam
God... please help me become the person my dog thinks I am.