Arsip: calculted field

 
user image
more 13 years ago

vera

mas nanya dong aku pnya 1 dtaset dmana dataset tsb punya beberapa calculated field nah untuk transaksi visualnya ak pakai dbgrid nag gmana caranya mengcalculate total dri

procedure TDMTransaksi.qry_transdetail1CalcFields(DataSet: TDataSet);
var Arange: integer;
  Adiscount: double;
begin
  Arange := trunc(qry_transdetail1DEPARTUREDATE.Value - qry_transdetail1ARRIVALDATE.Value);
  if Arange = 0 then Arange := 1;

  if (not qry_transdetail1ARRIVALDATE.IsNull) and
    (not qry_transdetail1DEPARTUREDATE.IsNull) and
    (not (qry_transdetail1DEPARTUREDATE.Value < qry_transdetail1ARRIVALDATE.Value)) and
    (not qry_transdetail1HARGA.IsNull)
    then
  begin
    if qry_transdetail1DISCOUNT.Value >= 0 then
      Adiscount := ((qry_transdetail1DISCOUNT.Value / 100)  qry_transdetail1HARGA.Value)   Arange;
//    field total per baris grid//
qry_transdetail1CALCTOTAL.Value :=
      (qry_transdetail1HARGA.Value * Arange) - Adiscount;
  end;
nah gmna crnya ak dpetin total dri keseluruhan qry_transdetail1CALCTOTAL.Value ada di semua baris grid misalnya di grid ada 10 bris
user image
more 13 years ago

madi


procedure TForm1.Button1.Onclick(Sender:Tobject);
var 
  i : integer;
  total : float;
begin
 for i := 0 to table.recordcount -1 do
  begin
     total := total + qry_transdetail1calctotal.value;
  end;
end;
user image
more 13 years ago

madi


procedure TForm1.Button1click(Sender:Tobject);
   var
      i : integer;
      total : float;
begin
      with qry_transdetail1 do
     begin
       first;
       disablecontrols;
      for i := 0 to recordcount -1 do
        begin
         total := total + qry_transdetail1calctotal.value;
         next;
        end;
     enablecontrols;
     showMessage('Total : '+ formatFloat('###,###,###',total);
   end;
end;
user image
more 13 years ago

madi

hahaha....dua kali salah terus....:D

procedure TForm1.Button1click(Sender:Tobject);
 var
      i : integer;
      total : double;
begin
  with qry_transdetail1 do
     begin
      first;
      disablecontrols;
        for i := 0 to recordcount -1 do
         begin
           total := total + qry_transdetail1calctotal.value;
           next;
         end;
      enablecontrols;
      showMessage('Total : '+ formatFloat('###,###,###',total);
      end;
 end;
user image
more 13 years ago

vera

mas madi mksih jwabanny, tpi klo yg itu vere jg dah bsa, cman vera pngen tau gmana caranya tiap rubah baris di grid tanpa hrus ngeloop dtaset lgi,vera prnah baca help ny ktnya pakai fieldkind TAgregate, cman tiap kli bkin new field aggregate ,error trus ''invalid field kind'
user image
more 13 years ago

madi

mang datasetnya pake apa? klo clientdataset ada contohnya... http://dsoft.dnsalias.com/images/delphi/calcs.rar
user image
more 13 years ago

vera

klo pakai ado bisa ga ya mas
user image
more 13 years ago

madi

wah klo ado lom pernah coba neh...tunggu para "suhu" komentar dulu...:D
user image
more 13 years ago

simple_code

nampilin total perbaris dengan calculatedField di ADO??? jawabnya : BISA.
more ...
  • Pages:
  • 1
Share to
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com