Jump to content

taariq

Members
  • Content Count

    29
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. taariq

    Currency Calculations

    updated
  2. taariq

    Currency Calculations

    Good day I change the name of the edit box and the var
  3. taariq

    Currency Calculations

    thanks for reply what I get, when using text and no StrTo
  4. taariq

    Currency Calculations

    Good day Lets see if I got it now -
  5. taariq

    Currency Calculations

    Good day I got a nice google video on how to run and use debugger... What I see now ...but still don't understand
  6. taariq

    Currency Calculations

    Good day I got this ?
  7. taariq

    Currency Calculations

    Thanks for quick reply Do you know how to use the debugger to inspect vakues being passed to StrToCurr? > this will be so helpful - how do I inspect error Thank you
  8. taariq

    Currency Calculations

    Good day Plz note I am a newbie to Delphi and still learning but enjoying it... I need help with calculations please... I got total sum via database by using the following code that is working... dmuse.dmDBuse.FDQueryMaterialTotal.Open('SELECT SUM(COST) AS TC FROM MATERIAL WHERE ORDERNO=:d',[dbOrderNo.Text]); Showmessage(format( 'Total for Material OrderNo %s is %m',[dbOrderNo.text,dmuse.dmDBuse.FDQueryMaterialTotal.FieldbyName('TC').asCurrency])); tMaterial.text:=Format('%m',[dmuse.dmDBuse.FDQueryMaterialTotal.fieldbyName('TC').asCurrency]); dmuse.dmDBuse.fdQueryTraveling.Open('SELECT SUM(COST) AS TC FROM TRAVELING WHERE ORDERNO=:d',[dbOrderNo.Text]); Showmessage(format( 'Total for Traveling OrderNo %s is %m',[dbOrderNo.text,dmuse.dmDBuse.fdQueryTraveling.FieldbyName('TC').asCurrency])); tTraveling.text:=Format('%m',[dmuse.dmDBuse.fdQueryTraveling.fieldbyName('TC').asCurrency]); But here is my issue - trying to add the two values together Code I tried but get error - Code I am using... procedure TForm1.Button2Click(Sender: TObject); var tMaterial, tTraveling, tTotalCost: Currency ; usSet : TFormatSettings; begin usSet:=TFormatSettings.Create('EN_US'); tMaterial := StrToCurr (lbMaterial.Caption,usSet) ; tTraveling := StrToCurr (lbTraveling.Caption,usSet) ; tTotalCost := tMaterial + tTraveling; tProjectCosting.text := CurrToStrF(tTotalCost, ffCurrency, 2); end; Please help Thank you
  9. taariq

    Syntax error in From clause

    It is finally working... Thank you so much I am definitely going to redo it now and learn learn.... Thank you so much for your time....
  10. taariq

    Syntax error in From clause

    Good day Thank you - getting closer now.... I updated the code to include amountex - hope I did it correct - it runs and then I get this error... My current records The updated code procedure TMainForm.Button1Click(Sender: TObject); //declare var to enter new job card var sOrderNo, sJobName , sStartDate, sCompletionDate, sAmountEx: string ; begin sOrderNo := Inputbox ( 'OrderNo' , 'Enter OrderNo' , 'QU000' ) ; sJobName := Inputbox ( 'JobName' , 'Enter JobName' , 'Company Name' ) ; sStartDate := Inputbox ( 'StartDate' , 'Enter Start Date' , 'YYYY/MM/DD' ) ; sCompletionDate := Inputbox ( 'CompletionDate' , 'Enter Completion Date' , 'YYYY/MM/DD' ) ; sAmountEx := Inputbox ( 'AmountEx' , 'Enter Amount Ex' , 'R ' ) ; dmTas.tblJobCard.Connection.ExecSQL('INSERT INTO jobCard (orderno,jobname,StartDate,Completiondate,AmountEx) values (?,?,?,?,?)', [sOrderNo,sJobName,sStartDate,sCompletionDate,sAmountEx]); // // if you want to retrieve last id you can use ExecSQLScalar //LID:=dmTas.tblJobCard.Connection.ExeSQL('INSERT INTO jobCard (orderno,jobname,StartDate,Completiondate,AmountEx) values (?,?,?,?,?) RETRUNING ID into :id', [sOrderNo,sJobName,sStartDate,sCompletionDate,sAmountEx]); // put LID as private or public of the form // do refresh Grid end;
  11. taariq

    Syntax error in From clause

    Good day I get runtime error? Sure I did something wrong - I did check my typing
  12. taariq

    Syntax error in From clause

    Good day I did create Generator BUT for some reason Only works in Flamerobin and not in Delphi...
  13. taariq

    Syntax error in From clause

    Good day Thank you so much I will have a look - this is my first FlameRobin and Firecad database - I had it all working 100% with a Access database... So now just trying to understand Flamerobin and Firecad ...... But for now if I want to take the ID as I got it in DBText2 and + 1 their how will I set the following to get the value from a label or the dbtext iID:= StrToInt ( Inputbox ( 'ID' , 'ID' , '002' ) ) ;
  14. taariq

    Syntax error in From clause

    That is the issue I got ? In Flamerobin I can add a record and it generates the id for the next record... But in Delphi it asks for ID? My code that I currently got where it asks for id... I get error > Field 'ID' must have a value. procedure TMainForm.Button1Click(Sender: TObject); //declare my var to enter new job card var sOrderNo, sJobName , sStartDate, sCompletionDate, sAmountEx: string ; //iID : integer; begin //asign values to input box //iID:= StrToInt ( Inputbox ( 'ID' , 'ID' , '002' ) ) ; sOrderNo := Inputbox ( 'OrderNo' , 'Enter OrderNo' , 'QU000' ) ; sJobName := Inputbox ( 'JobName' , 'Enter JobName' , 'Company Name' ) ; sStartDate := Inputbox ( 'StartDate' , 'Enter Start Date' , 'YYYY/MM/DD' ) ; sCompletionDate := Inputbox ( 'CompletionDate' , 'Enter Completion Date' , 'YYYY/MM/DD' ) ; sAmountEx := Inputbox ( 'AmountEx' , 'Enter Amount Ex' , 'R ' ) ; //insert values to DBgrid dmTaS.tblJobCard.Insert ; //dmTaS.tblJobCard['ID' ] := iID ; dmTaS.tblJobCard['OrderNo' ] := sOrderNo ; dmTaS.tblJobCard['JobName' ] := sJobName ; dmTaS.tblJobCard['StartDate' ] := sStartDate ; dmTaS.tblJobCard['CompletionDate' ] := sCompletionDate ; dmTaS.tblJobCard['AmountEx' ] := sAmountEx ; dmTaS.tblJobCard.Post ; //refresh db grid DBGrid1.DataSource.DataSet.Refresh; //show mesagges end; But if I do it like the following and add the ID manually it works - so I sorted the query via sql to get the last ID - I have the last ID in DBText2 - so now trying to figure out how to + 1 and give the value to iID procedure TMainForm.Button1Click(Sender: TObject); //declare my var to enter new job card var sOrderNo, sJobName , sStartDate, sCompletionDate, sAmountEx: string ; iID : integer; begin //asign values to input box iID:= StrToInt ( Inputbox ( 'ID' , 'ID' , '002' ) ) ; sOrderNo := Inputbox ( 'OrderNo' , 'Enter OrderNo' , 'QU000' ) ; sJobName := Inputbox ( 'JobName' , 'Enter JobName' , 'Company Name' ) ; sStartDate := Inputbox ( 'StartDate' , 'Enter Start Date' , 'YYYY/MM/DD' ) ; sCompletionDate := Inputbox ( 'CompletionDate' , 'Enter Completion Date' , 'YYYY/MM/DD' ) ; sAmountEx := Inputbox ( 'AmountEx' , 'Enter Amount Ex' , 'R ' ) ; //insert values to DBgrid dmTaS.tblJobCard.Insert ; dmTaS.tblJobCard['ID' ] := iID ; dmTaS.tblJobCard['OrderNo' ] := sOrderNo ; dmTaS.tblJobCard['JobName' ] := sJobName ; dmTaS.tblJobCard['StartDate' ] := sStartDate ; dmTaS.tblJobCard['CompletionDate' ] := sCompletionDate ; dmTaS.tblJobCard['AmountEx' ] := sAmountEx ; dmTaS.tblJobCard.Post ; //refresh db grid DBGrid1.DataSource.DataSet.Refresh; //show mesagges end;
×