//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "capg_ifact.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TiFact *iFact;
//---------------------------------------------------------------------------
__fastcall TiFact::TiFact(TComponent* Owner)
        : TForm(Owner)
{
  TbPendientes->Active = true;
}
//---------------------------------------------------------------------------
void __fastcall TiFact::BitBtn1Click(TObject *Sender)
{
 Currency TotalA, TotalNA;
 TbFacturas->Active = true;
 TbFacturas->Filter = "[fechaP] >= '" + fdesde->Date.FormatString("dd/mm/yyyy") + "' AND [fechaP] <= '" + fhasta->Date.FormatString("dd/mm/yyyy") +"'";
 TbFacturas->Filtered = true;

 TotalA = 0; TotalNA = 0;
 TbFacturas->First();
 while( !TbFacturas->Eof )
 {
   if ( TbFacturas->FieldByName("idc")->AsInteger  == -1 )
   {
     TotalNA += TbFacturas->FieldByName("importe")->AsCurrency;
   } else {
     TotalA += TbFacturas->FieldByName("importe")->AsCurrency;
   }
   TbFacturas->Next();
 }
 TbFacturas->Active = false;
 lTotalA->Caption = TotalA;
 lTotalNA->Caption = TotalNA;

}
//---------------------------------------------------------------------------
