Topic: Small script help please.....

I was trying to include two condition (boolean and Combobox) to perform the action with the below:

procedure frmSalesInv_btnCalc_OnClick (Sender: string; var Cancel: boolean; vrate:integer);
begin
vrate := sqlexecute('select taxrate from taxrates where id = '+frmSalesInv.cbSaleInvTaxRate.sqlvalue);
  if frmSalesInv.cBoxSale.checked = True and        // if it's a DB line
     frmSalesInv.cbSaleInvDBCR.dbItemID = 0 then
    begin
     ...
    end;

  if  frmSalesInv.cBoxSale.checked = True and     // if it's a CR line
      frmSalesInv.cbSaleInvDBCR.dbItemID = 1 then
    begin
      ...
    end;
end;

It didn't work. I couldn't get the right syntax/structure to join both conditions?
I'm trying to convert sale into credit inv (refund) on same inv form.

Adam
God... please help me become the person my dog thinks I am.

Re: Small script help please.....

Hello AD,


Try to wrap your conditions when you chain more than one between ( and )

if (frmSalesInv.cBoxSale.checked = True) and        // if it's a DB line
     (frmSalesInv.cbSaleInvDBCR.dbItemID = 0) then

This should hopefully solve your problem .


Cheers


Math

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: Small script help please.....

Hi Math,


Thank you very much..............
Still an absolute beginner I'm.. Couldn't think wrapping.
Your quick help truly appreciated.............

Adam
God... please help me become the person my dog thinks I am.