⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ana_agenti_u.pas

📁 基于OOP设计的一套较好的ERP系统
💻 PAS
字号:
unit ana_agenti_u;

interface

uses
  SysUtils, Dialogs, Windows, Messages, Classes, Graphics, Controls,
  StdCtrls, Forms, DBCtrls, DB, DBTables, Mask, ExtCtrls, Grids, DBGrids,
  ActnList, RxMemDS, Buttons, ComCtrls, ppDB, ppDBPipe, ppDBBDE, ppEndUsr,
  ppComm, ppRelatv, ppProd, ppClass, ppReport, ppBands, ppCache;

type
  TAna_agenti_form = class(TForm)
    ScrollBox: TScrollBox;
    Label1: TLabel;
    EditCodice: TDBEdit;
    Label2: TLabel;
    EditRagionesociale: TDBEdit;
    Label3: TLabel;
    EditIndirizzo: TDBEdit;
    Label4: TLabel;
    EditCap: TDBEdit;
    Label5: TLabel;
    EditLocalita: TDBEdit;
    Label6: TLabel;
    EditProvincia: TDBEdit;
    Label7: TLabel;
    Label8: TLabel;
    EditPartitaIVA: TDBEdit;
    Label9: TLabel;
    EditCodiceFiscale: TDBEdit;
    Label10: TLabel;
    EditEL: TDBEdit;
    Label11: TLabel;
    EditTelefono: TDBEdit;
    Label12: TLabel;
    EditFax: TDBEdit;
    Label13: TLabel;
    EditDati: TDBEdit;
    Label14: TLabel;
    EditEmail: TDBEdit;
    Label15: TLabel;
    EditURL: TDBEdit;
    DBNavigator: TDBNavigator;
    Panel1: TPanel;
    Panel2: TPanel;
    Chiudi_but: TButton;
    Griglia: TDBGrid;
    Label16: TLabel;
    DBLookupComboBox1: TDBLookupComboBox;
    ActionList1: TActionList;
    Aiuto: TAction;
    Provvigioni: TAction;
    Button1: TButton;
    Label17: TLabel;
    DBLookupComboBox2: TDBLookupComboBox;
    DBCheckBox1: TDBCheckBox;
    Stp_provvigioni: TAction;
    RxSaldati: TRxMemoryData;
    RxAnnullati: TRxMemoryData;
    RxSaldatiNumero: TIntegerField;
    RxSaldatidata: TDateField;
    RxSaldatidata_saldo: TDateField;
    RxSaldatiPrimo: TBooleanField;
    RxSaldatiProvv: TIntegerField;
    RxSaldatiRagioneSociale: TStringField;
    RxSaldatiImporto: TCurrencyField;
    RxSaldatiNetto: TCurrencyField;
    RxSaldatiImportoProv: TCurrencyField;
    RxSaldatiProvRestante: TCurrencyField;
    RxAnnullatiNumero: TIntegerField;
    RxAnnullatidata: TDateField;
    RxAnnullatidata_annullato: TDateField;
    RxAnnullatiPrimo: TBooleanField;
    RxAnnullatiRagioneSociale: TStringField;
    RxAnnullatiImporto: TCurrencyField;
    DsSaldati: TDataSource;
    DsAnnuallti: TDataSource;
    ppProvvigioni: TppReport;
    Design: TppDesigner;
    ppBDEPipeline1: TppBDEPipeline;
    ppBDEPipeline2: TppBDEPipeline;
    GroupBox1: TGroupBox;
    DBRadioGroup1: TDBRadioGroup;
    DBEdit1: TDBEdit;
    Label18: TLabel;
    procedure Chiudi_butClick(Sender: TObject);
    procedure GrigliaDblClick(Sender: TObject);
    procedure AiutoExecute(Sender: TObject);
    procedure ProvvigioniExecute(Sender: TObject);
    procedure Stp_provvigioniExecute(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Ana_agenti_form: TAna_agenti_form;

implementation

uses ana_mod, ricerca_u, Umenu, u_ana_provvigioni;

{$R *.DFM}

procedure TAna_agenti_form.Chiudi_butClick(Sender: TObject);
begin
     If (EditCodice.DataSource.DataSet.State = dsEdit) or
        (EditCodice.DataSource.DataSet.State = dsInsert) then
        if MessageDlg('Attenzione, salvare le modifiche ?',mtConfirmation,[mbYes,mbNo],0) = mrYes then
           EditCodice.DataSource.DataSet.Post ;
     release ;
end;

procedure TAna_agenti_form.GrigliaDblClick(Sender: TObject);
begin
     With lookup_form do
          begin
               anagrafica_but.Action := Menu_form.Zone ;
               griglia.datasource := moduloDatiAnagrafiche.DSZone ;
               If showModal = mrOk then
                  begin
                       moduloDatiAnagrafiche.TTAgZone.Edit ;
                       moduloDatiAnagrafiche.TTAgZoneZona.value := moduloDatiAnagrafiche.TTZoneZona.value ;
                  end ;

          end ;
end;

procedure TAna_agenti_form.AiutoExecute(Sender: TObject);
begin
     menu_form.Aiuto('manuale.pdf',165) ;
end;

procedure TAna_agenti_form.ProvvigioniExecute(Sender: TObject);
begin
     Ana_provvigioni := TAna_provvigioni.Create(self) ;
     Ana_provvigioni.showmodal ;
end;

procedure TAna_agenti_form.Stp_provvigioniExecute(Sender: TObject);
var tdoc,Econto,Tdoc_Origine : ttable ;
    saldato : boolean ;
    data_saldo : String ;
begin
{     Tdoc := TTable.Create(nil) ;
     Tdoc.DatabaseName := 'euro2000' ;
     Tdoc.TableName := 'Tdoc.db' ;
     Tdoc.IndexName := 'Tipo_data_numero' ;
     Tdoc.Open ;

     Tdoc_Origine := TTable.Create(nil) ;
     Tdoc_Origine.DatabaseName := 'euro2000' ;
     Tdoc_Origine.TableName := 'Tdoc.db' ;
     Tdoc_Origine.Open ;

     Econto := TTable.Create(nil) ;
     Econto.DatabaseName := 'euro2000' ;
     Econto.TableName := 'Econto.db' ;
     Econto.Open ;

     RxSaldati.Open ;
     RxAnnullati.Open ;

     while not RxSaldati.IsEmpty do
       RxSaldati.Delete ;

     while not RxAnnullati.IsEmpty do
       RxAnnullati.Delete ;

     if Tdoc.FindKey([Tipo.Text]) then
       begin
          while (not Tdoc.Eof) and (Tdoc.FieldByName('Tipo').AsString = Tipo.Text) and (Tdoc.FieldByName('Data').AsDateTime <= Dal.Date) do
            begin
              if Tdoc.FieldByName('Data').AsDateTime >= Dal.Date then
               begin
                if Tdoc.FieldByName('Annullato').AsBoolean then
                  begin
                    RxAnnullati.Insert ;
                    RxAnnullati.FieldByName('Numero').AsString := Tdoc.FieldByName('Numero').AsString ;
                    RxAnnullati.FieldByName('Data').AsString := Tdoc.FieldByName('Data').AsString ;
                    RxAnnullati.FieldByName('data_annullato').AsString := Tdoc.FieldByName('Data annullato').AsString ;
                    RxAnnullati.FieldByName('Primo').AsBoolean := Tdoc.FieldByName('Primo doc').AsBoolean ;
                    RxAnnullati.FieldByName('Ragione sociale').AsString := Tdoc.FieldByName('Ragione sociale documento').AsString ;
                    RxAnnullati.FieldByName('Importo').AsCurrency := Tdoc.FieldByName('Totale L').AsCurrency ;
                    RxAnnullati.Post ;
                  end ;
                if (Tdoc_Origine.FindKey([Tdoc.FieldByName('Documento').AsInteger])) and (not Tdoc.FieldByName('Annullato').AsBoolean) then
                  begin
                       RxSaldati.Insert ;
                       RxSaldati.FieldByName('Numero').AsInteger := Tdoc_Origine.FieldByName('Numero').AsInteger ;
                       RxSaldati.FieldByName('Data').AsString := Tdoc_Origine.FieldByName('Data').AsString ;
                       RxSaldati.FieldByName('Data_Saldo').AsString := Tdoc.FieldByName('Data').AsString ;
                       RxSaldati.FieldByName('Primo').AsBoolean := Tdoc_origine.FieldByName('Primo doc').AsBoolean ;
                       if Tdoc.FieldByName('Soggetto').AsString = Tdoc.FieldByName('Agente').AsString then
                         if ModuloDatiAnagrafiche.TTAg_doc.FindKey([Tdoc.FieldByName('Soggetto').AsString,Tdoc.FieldByName('Tipo').AsString]) then
                           begin
                             if RxSaldati.FieldByName('Primo').AsBoolean then
                               RxSaldati.FieldByName('Provv').AsInteger := ModuloDatiAnagrafiche.TTAg_docPrimaProvv.AsInteger
                             else
                               RxSaldati.FieldByName('Provv').AsInteger := ModuloDatiAnagrafiche.TTAg_docProvvigioneGenerale.AsInteger ;
                           end
                         else
                           begin
                             if ModuloDatiAnagrafiche.TTSoggetti.FindKey([Tdoc.FieldByName('Soggetti').AsString]) then
                               begin
                                 if ModuloDatiAnagrafiche.TTSoggettiCapoGruppo.AsBoolean then
                                   begin
                                     if ModuloDatiAnagrafiche.TTGru_Doc.Locate('Tipo documento',Tdoc_origine.FieldByName('Tipo').AsString,[]) then
                                       RxSaldati.FieldByName('Provv').AsInteger := ModuloDatiAnagrafiche.TTGru_DocProvvigioneGenerale.AsInteger
                                     else
                                       RxSaldati.FieldByName('Provv').AsInteger := ModuloDatiAnagrafiche.TTGru_DocPrimaProvv.AsInteger ;
                                   end
                                 else
                                   begin
                                      if ModuloDatiAnagrafiche.TTArea_Doc.Locate('Tipo documento',Tdoc_origine.FieldByName('Tipo').AsString,[]) then
                                       RxSaldati.FieldByName('Provv').AsInteger := ModuloDatiAnagrafiche.TTArea_DocProvvigioneGenerale.AsInteger
                                     else
                                       RxSaldati.FieldByName('Provv').AsInteger := ModuloDatiAnagrafiche.TTArea_DocPrimaProvv.AsInteger ;
                                   end ;
                               end ;
                           end ;
                       RxSaldati.FieldByName('Ragione Sociale').AsString := Tdoc_Origine.FieldByName('Ragione sociale documento').AsString ;
                       RxSaldati.FieldByName('Importo').AsCurrency := Tdoc_Origine.FieldByName('Totale L').AsCurrency ;
                       RxSaldati.FieldByName('Netto').AsCurrency := Tdoc_Origine.FieldByName('Imponibile scontato').AsCurrency ;
                       RxSaldati.FieldByName('Importo Prov').AsCurrency := (RxSaldati.FieldByName('Netto').AsCurrency / 100) * RxSaldati.FieldByName('Provv').AsInteger ;
                       RxSaldati.FieldByName('Prov Restante').AsCurrency := Tdoc.FieldByName('Imponibile socntato').AsCurrency - RxSaldati.FieldByName('Importo Prov').AsCurrency ;
                       RxSaldati.Post ;

                  end ;
               end ;
            end ;
       end ;


     ppProvvigioni.Template.FileName := Edit1.Text ;
     ppProvvigioni.Print ;

     Tdoc.Close ;
     Tdoc.Free ;

     TDoc_Origine.Close ;
     Tdoc_Origine.Free ;

     Econto.Close ;
     Econto.Free ;

     RxSaldati.Close ;
     RxAnnullati.Close ;

}
end;

procedure TAna_agenti_form.BitBtn2Click(Sender: TObject);
begin
     design.Show ;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -