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

📄 ribawizard_u.pas

📁 基于OOP设计的一套较好的ERP系统
💻 PAS
📖 第 1 页 / 共 3 页
字号:
                                                begin
                                                     strApp := strApp + decina[cifra];
                                                     if (terzetti[i][3] = '8') or (terzetti[i][3] = '1') then
                                                        StrApp := copy(StrApp,1,(length(StrApp) - 1));
                                                end;
                                       end;
                               end;

    //Analisi cifra unita del terzetto
                            if j = 3 then
                               begin
                                    if terzetti[i][2] <> '1' then
                                       if cifra > 0 then
                                          StrApp := StrApp + unita[cifra];
                               end;

                         end;
                end;

//Aggiunta degli attributi
            if strToInt(terzetti[i]) > 1 then
              if i < 4 then
                 StrApp := StrApp + attrib[i];

            if StrApp <> '' then
              Parola := StrApp + Parola;

        end;


    result := parola + '/' + decim;

end;

function TRibaWizard_form.NumeraRiba(Codice, Anno : String) : LongInt;
var
   num : TTable;
   numrit : LongInt;

begin
//Calcola il numeratore assoluto delle Riba

     num := TTable.create(self);
     num.databaseName := 'euro2000';
     num.TableName := 'numera.db';
     num.open;

     if num.findKey([Codice, Anno]) then
        begin
             num.edit;
             num.FieldByName('Valore').Value := num.FieldByName('Valore').Value + 1;
             num.Post;
        end
     else
         begin
             num.insert;
             num.FieldByName('Numeratore').Value := Codice;
             num.FieldByName('Anno').Value := Anno;
             num.FieldByName('Valore').Value := 1;
             num.post;
         end;

     numRit := num.FieldByName('Valore').Value;

     num.close;

     result := numRit;

end;

procedure TRibaWizard_form.elencoFatture();
var
   ec, Tfat : TTable;
   Totale : Currency;

begin
//Generazione elenco

     TTRiba_fat.DisableControls;
     TTRibaTipi.DisableControls;
     TTModPagRiba.disableControls;

     while not TTRiba_Fat.eof do
           TTRiba_fat.Delete;

     ec := TTable.create(self);
     ec.DatabaseName := 'euro2000';
     ec.TableName := 'Econto.db';
     ec.open;

     tfat := TTable.create(self);
     tfat.DatabaseName := 'euro2000';
     tfat.TableName := 'Tdoc.db';
     tfat.open;

     totale := 0;

     while not ec.eof do
           begin
             //Se il campo documento non e' vuoto...
             if not ec.fieldByName('Documento').isNull then
                //...cerchiamo in tfat il documento
                if tfat.findKey([ec.fieldByName('Documento').Value]) then
                  //Se il tipo documento non e' vuoto...
                  if not tfat.FieldByName('Tipo').isNull then
                   //... cerchiamo nei tipi di documento elencati...
                   if TTRibaTipi.findKey([tfat.FieldByName('Tipo').Value]) then
                      //...se questo e' incluso
                      if TTRibaTipiIncluso.Value then
                         //Se il tipo di pagamento non e' vuoto...
                        if not ec.fieldByName('Pagamento').isNull then
                         //...cerchiamo nei pagamenti elencati...
                         if TTModPagRiba.FindKey([ec.fieldByName('Pagamento').Value]) then
                            //...se prevede la riba elettronica
                            if TTModPagRiba.FieldByName('Riba elettronica').Value then
                               //Guardiamo se la data del documento rientra nel range indicato...
                               if not tfat.FieldByName('Data').isNull then
                                    if (tfat.FieldByName('Data').Value >= TTParRibaDal.Value) and
                                       (tfat.FieldByName('Data').Value <= TTParRibaAl.Value) then
                                            //...e creiamo l'elenco delle fatture
                                            begin
                                                 TTRiba_fat.insert;
                                                 if not ec.FieldByName('Scadenza').isNull then
                                                    TTRiba_fatScadenza.Value := ec.FieldByName('Scadenza').Value;
                                                 if not ec.FieldByName('Soggetto').isNull then
                                                    TTRiba_fatSoggetto.Value := ec.FieldByName('Soggetto').Value;
                                                 if not ec.FieldByName('Documento').isNull then
                                                    TTRiba_fatDocumento.Value := ec.FieldByName('Documento').Value;
                                                 if not tfat.FieldByName('Data').isNull then
                                                    TTRiba_fatDataDocumento.Value := tfat.FieldByName('Data').Value;
                                                 if not tfat.FieldByName('Numero').isNull then
                                                    TTRiba_fatNumeroDocumento.Value := tfat.FieldByName('Numero').Value;
                                                 if not tfat.FieldByName('Serie').isNull then
                                                    TTRiba_fatSerie.Value := tfat.FieldByName('Serie').Value;
                                                 if TTParRibaValuta.Value = 'L' then
                                                    begin
                                                         if not ec.FieldByName('Avere L').isNull then
                                                            begin
                                                                 TTRiba_fatTotale.Value := ec.FieldByName('Avere L').Value;
                                                                 totale := totale + ec.FieldByName('Avere L').Value;
                                                            end;
                                                    end
                                                 else
                                                     begin
                                                          if not ec.FieldByName('Avere E').isNull then
                                                             begin
                                                                  TTRiba_fatTotale.Value := ec.FieldByName('Avere E').Value;
                                                                  totale := totale + ec.FieldByName('Avere E').Value;
                                                             end;
                                                     end;
                                                 TTRiba_fatElaborare.Value := 'Si';
                                                 TTRiba_fat.post;
                                            end;
                ec.next;
           end;

     ec.close;
     tfat.close;

     TTRiba_fat.EnableControls;
     TTRibatipi.EnableControls;
     TTModPagRiba.EnableControls;

     TTParRiba.edit;
     TTParRibaTotaleRiba.Value := Totale;
     TTParRiba.post;

end;

procedure TRibaWizard_form.GeneraRiba();
var
   Trb, Drb, Num, Tfat, Sog, BnRb : TTable;
   Prima, Ultima, gruppoRiba : Longint;
   Anno, Mese, Giorno : Word;
   TotaleRb, ImpBnc : Currency;
   Riferimento : String;
   //UnaBanca : String ;

begin
//Generazione riba

     Trb := TTable.create(self);
     Trb.DatabaseName := 'euro2000';
     Trb.TableName := 'Triba.db';
     Trb.open;

     Drb := TTable.create(self);
     Drb.DatabaseName := 'euro2000';
     Drb.TableName := 'Driba.db';
     Drb.open;

     Tfat := TTable.create(self);
     Tfat.DatabaseName := 'euro2000';
     Tfat.TableName := 'Tdoc.db';
     Tfat.open;

     Num := TTable.create(self);
     Num.DatabaseName := 'euro2000';
     Num.TableName := 'Numera.db';
     Num.open;

     Sog := TTable.create(self);
     Sog.DatabaseName := 'euro2000';
     Sog.TableName := 'Soggetti.db';
     Sog.open;

     Bnrb := TTable.create(self);
     Bnrb.databaseName := 'euro2000';
     Bnrb.TableName := 'Bancheriba.db';
     Bnrb.open;

     PBGenerazione.Max := TTRiba_fat.RecordCount;
     PBGenerazione.Min := 0;

     TTRiba_fat.DisableControls;
     TTRiba_fat.First;

     Prima := 999999999;
     Ultima := 0;

     GruppoRiba := NumeraRiba('GR','');

     while not TTRiba_fat.eof do
           begin
//Se la fattura e' da elaborare
             if TTRiba_fatElaborare.Value = 'Si' then
                begin
//Testata
                   if not Trb.Locate('Data scadenza;Debitore;Gruppo',varArrayOf([TTRiba_fatScadenza.Value,TTRiba_fatSoggetto.Value,GruppoRiba]),[locaseinsensitive]) then
                       begin
                            Trb.Insert;

                            Trb.FieldByName('Riba').Value := ModuloDatiAnagrafiche.IncNumeratore('RX','','','') ;                            //Trb.FieldByName('Banca appoggio').Value := TTParRibaBanca.Value;
                            DecodeDate(Now,Anno,Mese,Giorno);
                            Trb.FieldByName('Numero riba').Value := ModuloDatiAnagrafiche.IncNumeratore('RB',intToStr(Anno),'','') ;
                            if Trb.FieldByName('Numero riba').Value < Prima then
                               Prima := Trb.FieldByName('Numero riba').Value;
                            if Trb.FieldByName('Numero riba').Value > Ultima then
                               Ultima := Trb.FieldByName('Numero riba').Value;
                            Trb.FieldByName('Data Scadenza').Value := TTRiba_fatScadenza.Value;
                            Trb.FieldByName('Debitore').Value := TTRiba_fatSoggetto.Value;
                            if Tfat.findKey([TTRiba_fatDocumento.value]) then
                               begin
                                  if not TFat.FieldByName('Banca').isNull then
                                     Trb.FieldByName('Banca debitore').Value := TFat.FieldByName('Banca').Value
                                  else
                                      if sog.findKey([TTRiba_fatSoggetto.Value]) then
                                          if not sog.FieldByName('Banca').isNull then
                                              Trb.FieldByName('Banca debitore').Value := Sog.FieldByName('Banca').Value;
                               end;
                            Trb.FieldByName('Dettaglio elaborato').Value := False;
                            Trb.FieldByName('Disco').Value := false;
                            Trb.FieldByName('Gruppo').Value := GruppoRiba;
                            Trb.post;
                       end;

                end;

                PBGenerazione.Position := TTRiba_fat.RecNo;
                PBGenerazione.Update;

                TTRiba_fat.next;
           end;

     TTParDiscoRb.edit;
     if Prima = 999999999 then
        TTParDiscoRbNumeroPrimaRiba.Value := 0
     else
         TTParDiscoRbNumeroPrimaRiba.Value := Prima;
     if Ultima = 0 then
        TTParDiscoRbNumeroUltimaRiba.Value := 0
     else
         TTParDiscoRbNumeroUltimaRiba.Value := Ultima;
     TTParDiscoRb.post;

//Dettaglio

     PBImporti.Max := TTRiba_fat.RecordCount;
     PBImporti.Min := 0;

     TTRiba_fat.first;

     while not TTRiba_fat.eof do
           begin
//Se la fattura e' da elaborare
             if TTRiba_fatElaborare.Value = 'Si' then
                begin
                   if Trb.Locate('Data scadenza;Debitore;Gruppo',varArrayOf([TTRiba_fatScadenza.Value,TTRiba_fatSoggetto.Value,GruppoRiba]),[locaseinsensitive]) then
                     if not Trb.FieldByName('Dettaglio elaborato').Value then
                       begin
                            Drb.insert;
                            Drb.FieldByName('Riba').Value := Trb.FieldByName('Riba').Value;
                            Drb.FieldByName('Documento').Value := TTRiba_fatDocumento.Value;
                            Drb.FieldByName('Numero fattura').Value := TTRiba_fatNumeroDocumento.Value;
                            if not TTRiba_fatSerie.IsNull then
                               Drb.FieldByName('Serie').Value := TTRiba_fatSerie.Value;
                            Drb.FieldByName('Data fattura').value := TTRiba_fatDataDocumento.Value;
                            if Tfat.findKey([TTRiba_fatDocumento.value]) then
                               begin
                                    if TTParRibaValuta.Value = 'L' then
                                       Drb.FieldByName('Importo totale fattura').Value := Tfat.fieldByName('Totale L').value
                                    else
                                       Drb.FieldByName('Importo totale fattura').Value := Tfat.fieldByName('Totale E').value;
                               end;
                            Drb.FieldByName('Importo Riba').Value := TTRiba_fatTotale.Value;
                            Drb.post;
                       end;
                end;

                PBImporti.Position := TTRiba_fat.RecNo;

⌨️ 快捷键说明

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