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

📄 wizard.pas

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

unit wizard;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, db,
  ComCtrls, Grids, DBGrids, ActnList, StdCtrls, ToolWin, ExtCtrls, DBCtrls,
  DBGridEh, DBTables, Mask, ppVar, ppCtrls, ppPrnabl, ppClass, ppDB,
  ppBands, ppProd, ppReport, ppComm, ppRelatv, ppCache, ppDBPipe, ppDBBDE,
  ppModule, raCodMod, myChkBox, daDatMod, ppStrtch, ppMemo, ppRichTx;

type
  Twizard_lista = class(TForm)
    Pagine: TPageControl;
    Lista_Art: TTabSheet;
    Selez_Art: TTabSheet;
    ToolBar1: TToolBar;
    Annulla: TButton;
    Button1: TButton;
    Button2: TButton;
    ToolBar2: TToolBar;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    selezione: TComboBox;
    ListaGrid: TDBGridEh;
    Qselezione: TQuery;
    Selez_grid: TDBGrid;
    DSQselezione: TDataSource;
    DBNavigator3: TDBNavigator;
    DBNavigator4: TDBNavigator;
    Pren_Lista: TTabSheet;
    ToolBar4: TToolBar;
    Button9: TButton;
    Button10: TButton;
    Fine: TButton;
    Panel1: TPanel;
    Nominativo: TEdit;
    Label1: TLabel;
    Telefono: TEdit;
    Label2: TLabel;
    Panel2: TPanel;
    Label3: TLabel;
    CaparraL: TEdit;
    Label4: TLabel;
    CaparraE: TEdit;
    Label6: TLabel;
    Label7: TLabel;
    TotaleL: TEdit;
    TotaleE: TEdit;
    dprenotazioni: TTable;
    dprenotazioniIdrigalista: TIntegerField;
    dprenotazioniIdprenotazione: TIntegerField;
    dprenotazioniQta: TFloatField;
    dprenotazioniPrezzoL: TCurrencyField;
    dprenotazioniPrezzoE: TCurrencyField;
    Tprenotazioni: TTable;
    TprenotazioniIdprenotazione: TIntegerField;
    TprenotazioniNominativo: TStringField;
    TprenotazioniNtelefono: TStringField;
    TprenotazioniCaparraL: TCurrencyField;
    TprenotazioniCaparraE: TCurrencyField;
    TprenotazioniStato: TStringField;
    QselezioneDescrizione: TStringField;
    QselezionePrezzoL: TCurrencyField;
    QselezionePrezzoE: TCurrencyField;
    QselezioneQtaselezionata: TFloatField;
    TprenotazioniConsegna: TStringField;
    QselezioneIdlista: TIntegerField;
    QselezioneIdriga: TIntegerField;
    QselezioneSezione: TStringField;
    QselezioneArticolo: TStringField;
    QselezioneQta: TFloatField;
    QselezioneQtaprenota: TFloatField;
    QselezioneQtaconsegnata: TFloatField;
    QselezioneOrdinamento: TIntegerField;
    QselezioneSelezione: TBooleanField;
    Artpresi: TCheckBox;
    QselezioneQtarimasta: TFloatField;
    QselezioneQtanonconsegnata: TFloatField;
    RadioVendita: TRadioGroup;
    listaw: TTable;
    DSlistaw: TDataSource;
    listawIdriga: TIntegerField;
    listawIdlista: TIntegerField;
    listawSezione: TStringField;
    listawArticolo: TStringField;
    listawDescrizione: TStringField;
    listawQta: TFloatField;
    listawPrezzoL: TCurrencyField;
    listawPrezzoE: TCurrencyField;
    listawQtaprenota: TFloatField;
    listawQtaconsegnata: TFloatField;
    listawOrdinamento: TIntegerField;
    listawSelezione: TBooleanField;
    listawQtaselezionata: TFloatField;
    listawQtarimasta: TFloatField;
    listawQtanonconsegnata: TFloatField;
    dpicklist: TTable;
    dpicklistIdrigalista: TIntegerField;
    dpicklistIdpicklist: TIntegerField;
    dpicklistArticolo: TStringField;
    dpicklistDescrizione: TStringField;
    dpicklistQta: TFloatField;
    tpicklist: TTable;
    tpicklistIdpicklist: TIntegerField;
    tpicklistIdlista: TIntegerField;
    tpicklistStatopicklist: TStringField;
    tpicklistIdvendita: TIntegerField;
    tpicklistDestinatario: TStringField;
    tpicklistModalitdiconsegna: TStringField;
    DSTprenotazioni: TDataSource;
    DSTpicklist: TDataSource;
    listawQtarimasta2: TFloatField;
    TprenotazioniId_lista: TIntegerField;
    listawQtavenduta: TFloatField;
    QselezioneQtavenduta2: TFloatField;
    Descrizione: TEdit;
    Cerca: TButton;
    Continua: TButton;
    Label5: TLabel;
    ActionList1: TActionList;
    Inizia_ricerca: TAction;
    Continua_ricerca: TAction;
    Consegna: TComboBox;
    Label8: TLabel;
    DSDprenotazioni: TDataSource;
    ppQselezione: TppBDEPipeline;
    ppPrenotazioni: TppReport;
    ppTprenotazioni: TppBDEPipeline;
    QselezioneDenominazione: TStringField;
    QselezioneArticoloetichetta: TStringField;
    QselezioneImportoL: TCurrencyField;
    QselezioneImportoE: TCurrencyField;
    listawImportoL: TCurrencyField;
    listawImportoE: TCurrencyField;
    listawIdGiornale: TStringField;
    TprenotazioniIdGiornale: TStringField;
    dprenotazioniIdGiornale: TStringField;
    tpicklistIdGiornale: TStringField;
    dpicklistIdGiornale: TStringField;
    QselezioneTotale: TFloatField;
    QselezioneSaldo: TFloatField;
    Testata: TMemo;
    QselezioneArticolofornitore: TStringField;
    listawArticoloetichetta: TStringField;
    Vendita: TppReport;
    ppHeaderBand1: TppHeaderBand;
    ppLabel5: TppLabel;
    ppDBText18: TppDBText;
    ppSystemVariable3: TppSystemVariable;
    ppDBText24: TppDBText;
    ppLine5: TppLine;
    ppLabel21: TppLabel;
    ppDBText19: TppDBText;
    ppLabel22: TppLabel;
    ppDBText20: TppDBText;
    ppDetailBand1: TppDetailBand;
    ppDBText26: TppDBText;
    ppDBText27: TppDBText;
    ppDBText28: TppDBText;
    ppDBText29: TppDBText;
    ppDBText30: TppDBText;
    ppDBText31: TppDBText;
    ppFooterBand1: TppFooterBand;
    ppSummaryBand2: TppSummaryBand;
    ppLabel23: TppLabel;
    ppLabel25: TppLabel;
    ppLabel26: TppLabel;
    ppDBText22: TppDBText;
    ppDBText23: TppDBText;
    ppDBText25: TppDBText;
    ppTPickList: TppBDEPipeline;
    ppDBMemo1: TppDBMemo;
    tpicklistTestata: TMemoField;
    tpicklistCliente: TStringField;
    tpicklistTelefono: TStringField;
    QselezionePostazione: TStringField;
    Label9: TLabel;
    Etichetta: TEdit;
    Scontrino: TDBCheckBox;
    ppDBRichText1: TppDBRichText;
    ppHeaderBand2: TppHeaderBand;
    ppLabel4: TppLabel;
    ppDBText7: TppDBText;
    ppDBText8: TppDBText;
    ppLabel6: TppLabel;
    ppDBText9: TppDBText;
    ppSystemVariable1: TppSystemVariable;
    ppLabel7: TppLabel;
    ppLabel8: TppLabel;
    ppLabel9: TppLabel;
    ppDBText10: TppDBText;
    ppDBText11: TppDBText;
    ppDBText12: TppDBText;
    ppLine1: TppLine;
    ppLine2: TppLine;
    ppLabel1: TppLabel;
    ppLine3: TppLine;
    ppLabel2: TppLabel;
    ppLine4: TppLine;
    ppDBText4: TppDBText;
    ppLabel3: TppLabel;
    ppDBText5: TppDBText;
    ppLabel10: TppLabel;
    ppDBText6: TppDBText;
    ppLabel11: TppLabel;
    ppLabel12: TppLabel;
    ppLabel19: TppLabel;
    myCheckBox1: TmyCheckBox;
    ppDBText16: TppDBText;
    ppLabel20: TppLabel;
    ppDBText17: TppDBText;
    ppDBRichText2: TppDBRichText;
    ppDetailBand2: TppDetailBand;
    ppDBText13: TppDBText;
    ppDBText14: TppDBText;
    ppDBText15: TppDBText;
    ppDBText1: TppDBText;
    ppDBText2: TppDBText;
    ppDBText3: TppDBText;
    ppFooterBand2: TppFooterBand;
    depositi_combo: TComboBox;
    Label10: TLabel;
    ppLabel13: TppLabel;
    procedure Button2Click(Sender: TObject);
    procedure AnnullaClick(Sender: TObject);
    procedure selezioneDropDown(Sender: TObject);
    procedure selezioneChange(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Lista_ArtExit(Sender: TObject);
    procedure Selez_ArtEnter(Sender: TObject);
    procedure Selez_ArtExit(Sender: TObject);
    procedure Button10Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure FineClick(Sender: TObject);
    procedure TprenotazioniAfterInsert(DataSet: TDataSet);
    procedure ArtpresiClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure listawBeforePost(DataSet: TDataSet);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure tpicklistAfterInsert(DataSet: TDataSet);
    procedure listawQtaselezionataChange(Sender: TField);
    procedure listawPrezzoLChange(Sender: TField);
    procedure CaparraLChange(Sender: TObject);
    procedure listawBeforeInsert(DataSet: TDataSet);
    procedure listawBeforeDelete(DataSet: TDataSet);
    procedure RadioVenditaClick(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure DescrizioneChange(Sender: TObject);
    procedure DSlistawDataChange(Sender: TObject; Field: TField);
    procedure Inizia_ricercaExecute(Sender: TObject);
    procedure Continua_ricercaExecute(Sender: TObject);
    procedure ConsegnaKeyPress(Sender: TObject; var Key: Char);
    procedure QselezioneCalcFields(DataSet: TDataSet);
    procedure listawCalcFields(DataSet: TDataSet);
    procedure listawAfterInsert(DataSet: TDataSet);
    procedure listawAfterPost(DataSet: TDataSet);
    procedure dprenotazioniAfterInsert(DataSet: TDataSet);
    procedure dpicklistAfterInsert(DataSet: TDataSet);
    procedure TprenotazioniAfterPost(DataSet: TDataSet);
    procedure tpicklistAfterPost(DataSet: TDataSet);
    procedure dprenotazioniAfterPost(DataSet: TDataSet);
    procedure dpicklistAfterPost(DataSet: TDataSet);
    procedure TprenotazioniBeforeDelete(DataSet: TDataSet);
    procedure tpicklistBeforeDelete(DataSet: TDataSet);
    procedure dprenotazioniBeforeDelete(DataSet: TDataSet);
    procedure dpicklistBeforeDelete(DataSet: TDataSet);
    procedure tpicklistCalcFields(DataSet: TDataSet);
    procedure EtichettaKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormCreate(Sender: TObject);
    procedure depositi_comboKeyPress(Sender: TObject; var Key: Char);
    procedure CaparraEChange(Sender: TObject);
  private
    { Private declarations }
  public
    AnnullaW: boolean;
    { Public declarations }
  end;

var
  wizard_lista: Twizard_lista;
  Chiudi: Boolean;
  TotL, TotE: Currency ;
  modifica: boolean;

implementation

uses Liste_nozze, u_Prenotazioni, main, u_consegna_mod, Consegna;

{$R *.DFM}

procedure Twizard_lista.Button2Click(Sender: TObject);
begin
   Pagine.ActivePage := Selez_Art;
end;

procedure Twizard_lista.AnnullaClick(Sender: TObject);
begin
     AnnullaW := True;
     if not RadioVendita.Enabled then
     begin
          Prenotazioni.Dprenotazioni.first;
          while not Prenotazioni.Dprenotazioni.Eof do
          begin
               if listaw.locate('Id riga',Prenotazioni.DPrenotazioniIdRigaLista.asInteger,[]) then
               begin
                    listaw.Edit;
                    listawQtaselezionata.AsInteger := 0;
                    ListawQtaprenota.AsInteger:=ListawQtaprenota.AsInteger+Prenotazioni.DprenotazioniQta.AsInteger;
                    Listawselezione.AsBoolean := False;
                    listaw.post;
               end;
               Prenotazioni.Dprenotazioni.next;
          end;
          Chiudi := True;
          Close;
          Exit;
     end;
     DsListaw.Enabled:=False;
     listaw.First;
     listaw.filtered := false;
     while not (listaw.eof) do
     begin
          listaw.edit;
          listawselezione.AsBoolean := false;
          listaw.Post;
          listaw.Next;
     end;
     listaw.First;
     DsListaw.Enabled:=True;
     Chiudi := True;
     close;
end;

procedure Twizard_lista.selezioneDropDown(Sender: TObject);
begin
   selezione.Items.Clear;
   selezione.Items.add('TUTTE');
   lista_nozze.TTSezione.First ;
   while not (lista_nozze.TTsezione.eof) do
   begin
     selezione.Items.Add(lista_nozze.TTsezionesezione.AsString);
     lista_nozze.TTsezione.next;
   end;
   lista_nozze.TTsezione.first;
end;

procedure Twizard_lista.selezioneChange(Sender: TObject);
begin
  if not (selezione.Text='TUTTE') then
     if (artpresi.Checked = false) then
     begin
          listaw.Filtered := False;
          listaw.Filter := 'qtarimasta2 <> 0 and sezione ='''+ selezione.text + '''';
          Listaw.filtered := True;
     end
     else
         begin
              listaw.filtered := false;
              listaw.Filter := 'sezione ='''+ selezione.text + '''';
              listaw.filtered:= true;
         end
  else
      if artpresi.Checked = false  then
      begin
           listaw.Filtered := False;
           listaw.Filter := 'qtarimasta2<>0';
           listaw.Filtered := True;
      end
      else
          begin
               listaw.filtered := false;
          end;
end;

procedure Twizard_lista.Button8Click(Sender: TObject);
begin
    Pagine.ActivePage := Lista_Art;
end;

procedure Twizard_lista.Button4Click(Sender: TObject);
begin
     Pagine.ActivePage := Lista_Art;
end;

procedure Twizard_lista.Lista_ArtExit(Sender: TObject);
begin
     if (listaw.Modified) then
        listaw.post;
     Qselezione.Active:=false;
end;

procedure Twizard_lista.Selez_ArtEnter(Sender: TObject);
begin
     Qselezione.Active := True;
     QSelezione.First;
     TotL := 0;
     TotE := 0;
     while (not QSelezione.eof) do
     begin
          TotL := TotL + (Main_form.round2(QselezionePrezzoL.AsFloat) * QselezioneQtaSelezionata.asfloat );
          TotE := TotE + (Main_form.ArrotondaImponibile4(QselezionePrezzoE.AsFloat,'E') * QselezioneQtaSelezionata.asFloat );
          QSelezione.Next;
     end;
     Qselezione.First;
     TotaleL.Text := formatfloat('#,###',TotL);
     TotaleE.Text := formatfloat('#,##0.00',TotE);
end;

procedure Twizard_lista.Selez_ArtExit(Sender: TObject);
begin
     Qselezione.Active := False;
end;

procedure Twizard_lista.Button10Click(Sender: TObject);
begin
     Pagine.ActivePage := Selez_Art;
end;

procedure Twizard_lista.Button5Click(Sender: TObject);
begin
    Pagine.ActivePage := Pren_Lista;
end;

procedure Twizard_lista.FineClick(Sender: TObject);
var Codice, Quantita : integer;
    Caparra : Currency;
    TotE : currency;
    Genera_Bolla,
    Stampa            : Boolean;
    Tscontr : ttable ;

begin
     if Lista_Nozze.liste.State = DsEdit then
        Lista_Nozze.liste.Post ;
     Qselezione.Active:=True;
     Qselezione.first;
     if Qselezione.Eof then
      begin
          Showmessage('Attenzione: Non 

⌨️ 快捷键说明

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