unit p_config;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  RzButton, ExtCtrls, RzPanel, cxVGrid, cxDBVGrid, cxControls,
  cxInplaceContainer, cxStyles, cxContainer, cxEdit, cxTextEdit,
  cxMaskEdit, cxDropDownEdit, cxColorComboBox, cxDBColorComboBox, StdCtrls,
  Mask, RzEdit, RzDBEdit, RzDBSpin, DBCtrls, AHMTPrinterCombo, Grids,
  DBGrids, Db, DBTables, IvDictio, IvMulti, EnJpgGr;

type
  Tf_config = class(TForm)
    cxDBVerticalGrid2: TcxDBVerticalGrid;
    cxDBVerticalGrid2CASHNO: TcxDBEditorRow;
    cxDBVerticalGrid2SALESNO: TcxDBEditorRow;
    cxDBVerticalGrid2SALESVATNO: TcxDBEditorRow;
    cxDBVerticalGrid2VATTYPE: TcxDBEditorRow;
    cxDBVerticalGrid2SITE: TcxDBEditorRow;
    cxDBVerticalGrid2SN: TcxDBEditorRow;
    cxDBVerticalGrid2CASHNAME: TcxDBEditorRow;
    cxDBVerticalGrid2POSBAR: TcxDBEditorRow;
    cxDBVerticalGrid2POSTOUCH: TcxDBEditorRow;
    cxStyleRepository1: TcxStyleRepository;
    cxStyle1: TcxStyle;
    cxStyle2: TcxStyle;
    cxStyle3: TcxStyle;
    cxStyle4: TcxStyle;
    cxStyle5: TcxStyle;
    cxStyle6: TcxStyle;
    cxStyle7: TcxStyle;
    RzPanel2: TRzPanel;
    cxDBVerticalGrid2DBEditorRow1: TcxDBEditorRow;
    RzGroupBox1: TRzGroupBox;
    cbkitchen: TAHMPrinterCombo;
    cbbar: TAHMPrinterCombo;
    cbcock: TAHMPrinterCombo;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    DBGrid1: TDBGrid;
    tosub: TTable;
    dtosub: TDataSource;
    tosub2: TTable;
    dtosub2: TDataSource;
    tosub3: TTable;
    dtosub3: TDataSource;
    DBEdit1: TDBEdit;
    DBEdit2: TDBEdit;
    DBEdit3: TDBEdit;
    DBEdit4: TDBEdit;
    cbfast: TAHMPrinterCombo;
    cbbouch: TAHMPrinterCombo;
    cbsnack: TAHMPrinterCombo;
    cboven: TAHMPrinterCombo;
    cxDBVerticalGrid2DBEditorRow2: TcxDBEditorRow;
    loccateg: TQuery;
    dloccateg: TDataSource;
    cxDBVerticalGrid2DBEditorRow3: TcxDBEditorRow;
    cxDBVerticalGrid2DBEditorRow4: TcxDBEditorRow;
    IvTranslator1: TIvTranslator;
    cxDBVerticalGrid2DBEditorRow5: TcxDBEditorRow;
    cxDBVerticalGrid2DBEditorRow7: TcxDBEditorRow;
    cxDBVerticalGrid2DBEditorRow8: TcxDBEditorRow;
    Label12: TLabel;
    CBCAFETERIA: TAHMPrinterCombo;
    DBEdit9: TDBEdit;
    DBEdit5: TDBEdit;
    DBEdit6: TDBEdit;
    DBEdit7: TDBEdit;
    Label14: TLabel;
    CBPATESSERIE: TAHMPrinterCombo;
    DBEdit11: TDBEdit;
    Label15: TLabel;
    CBPIZZA: TAHMPrinterCombo;
    DBEdit12: TDBEdit;
    Label16: TLabel;
    CBSHISHAZ: TAHMPrinterCombo;
    DBEdit13: TDBEdit;
    Label1: TLabel;
    DBEdit10: TDBEdit;
    AHMPrinterCombo1: TAHMPrinterCombo;
    cxDBVerticalGrid3: TcxDBVerticalGrid;
    cxDBEditorRow1: TcxDBEditorRow;
    DBCheckBox1: TDBCheckBox;
    DBCheckBox2: TDBCheckBox;
    cxDBVerticalGrid4: TcxDBVerticalGrid;
    cxDBEditorRow19: TcxDBEditorRow;
    cxDBEditorRow20: TcxDBEditorRow;
    cxDBEditorRow22: TcxDBEditorRow;
    cxDBEditorRow23: TcxDBEditorRow;
    cxDBEditorRow24: TcxDBEditorRow;
    cxDBEditorRow25: TcxDBEditorRow;
    cxDBVerticalGrid4DBEditorRow1: TcxDBEditorRow;
    cxDBVerticalGrid4DBEditorRow2: TcxDBEditorRow;
    cxDBVerticalGrid4DBEditorRow3: TcxDBEditorRow;
    cxDBVerticalGrid4DBEditorRow4: TcxDBEditorRow;
    cxDBVerticalGrid4DBEditorRow5: TcxDBEditorRow;
    RzBitBtn3: TRzBitBtn;
    cxDBVerticalGrid4DBEditorRow6: TcxDBEditorRow;
    RzBitBtn1: TRzBitBtn;
    RzBitBtn2: TRzBitBtn;
    Label11: TLabel;
    cbinvoice: TAHMPrinterCombo;
    DBEdit8: TDBEdit;
    cxDBVerticalGrid2DBEditorRow9: TcxDBEditorRow;
    cxDBVerticalGrid4DBEditorRow7: TcxDBEditorRow;
    cxDBVerticalGrid4DBEditorRow8: TcxDBEditorRow;
    procedure RzBitBtn1Click(Sender: TObject);
    procedure RzBitBtn2Click(Sender: TObject);
    procedure cxDBVerticalGrid2CASHNOEditPropertiesInitPopup(
      Sender: TObject);
    procedure cxDBVerticalGrid2SALESNOEditPropertiesInitPopup(
      Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure cbkitchenChange(Sender: TObject);
    procedure cbbarChange(Sender: TObject);
    procedure cbcockChange(Sender: TObject);
    procedure cbfastClick(Sender: TObject);
    procedure cbsnackClick(Sender: TObject);
    procedure cbbouchClick(Sender: TObject);
    procedure cbovenChange(Sender: TObject);
    procedure CBCAFETERIAChange(Sender: TObject);
    procedure CBPATESSERIEChange(Sender: TObject);
    procedure CBPIZZAChange(Sender: TObject);
    procedure CBSHISHAZChange(Sender: TObject);
    procedure AHMPrinterCombo1Change(Sender: TObject);
    procedure cbinvoiceChange(Sender: TObject);
    procedure RzBitBtn3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  f_config: Tf_config;

implementation

uses p_posmodule;

{$R *.DFM}

procedure Tf_config.RzBitBtn1Click(Sender: TObject);
begin
try
posmodule.CONFIGS.ApplyUpdates;
posmodule.CONFIGS.close;
posmodule.CONFIGS.open;

except
end;


try
posmodule.ZALE.ApplyUpdates;
posmodule.ZALE.Close;
posmodule.ZALE.open;

except
end;


close;
end;

procedure Tf_config.RzBitBtn2Click(Sender: TObject);
begin
posmodule.CONFIGS.cancelUpdates;
posmodule.CONFIGS.close;
posmodule.CONFIGS.open;
close;
end;

procedure Tf_config.cxDBVerticalGrid2CASHNOEditPropertiesInitPopup(
  Sender: TObject);
begin
tosub.close;

tosub.open;

end;

procedure Tf_config.cxDBVerticalGrid2SALESNOEditPropertiesInitPopup(
  Sender: TObject);
begin
tosub2.close;

tosub2.open;
end;

procedure Tf_config.FormShow(Sender: TObject);
begin
tosub.open;
tosub2.open;
tosub3.open;
loccateg.open;
end;

procedure Tf_config.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
try
tosub.close;
tosub2.close;
tosub3.close;
loccateg.close;
except
end;
end;

procedure Tf_config.cbkitchenChange(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSKITCHEN.AsString:=cbkitchen.SelectedPrinter;
end;

procedure Tf_config.cbbarChange(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSbar.AsString:=cbbar.SelectedPrinter;
end;

procedure Tf_config.cbcockChange(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSCOCKTAIL.AsString:=cbcock.SelectedPrinter;
end;

procedure Tf_config.cbfastClick(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSFASTFOOD.AsString:=cbfast.SelectedPrinter;
end;

procedure Tf_config.cbsnackClick(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSSNACK.AsString:=cbsnack.SelectedPrinter;
end;

procedure Tf_config.cbbouchClick(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSBOUCHERY.AsString:=cbbouch.SelectedPrinter;
end;

procedure Tf_config.cbovenChange(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSOVEN.AsString:=cboven.SelectedPrinter;
end;

procedure Tf_config.CBCAFETERIAChange(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSCAFETERIA.AsString:=CBCAFETERIA.SelectedPrinter;
end;

procedure Tf_config.CBPATESSERIEChange(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSPATESSERIE.AsString:=CBPATESSERIE.SelectedPrinter;
end;

procedure Tf_config.CBPIZZAChange(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSPIZZA.AsString:=CBPIZZA.SelectedPrinter;
end;

procedure Tf_config.CBSHISHAZChange(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSSHISHAZ.AsString:=CBSHISHAZ.SelectedPrinter;
end;

procedure Tf_config.AHMPrinterCombo1Change(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSORDERCHEF.AsString:=AHMPrinterCombo1.SelectedPrinter;
end;

procedure Tf_config.cbinvoiceChange(Sender: TObject);
begin
posmodule.CONFIGs.edit;
posmodule.CONFIGSPINVOICE.AsString:=cbinvoice.SelectedPrinter;
end;

procedure Tf_config.RzBitBtn3Click(Sender: TObject);
begin
posmodule.CONFIGS.edit;
posmodule.CONFIGSKITCHEN.AsString:='';
posmodule.CONFIGSBAR.AsString:='';
posmodule.CONFIGSCOCKTAIL.AsString:='';
posmodule.CONFIGSOVEN.AsString:='';
posmodule.CONFIGSFASTFOOD.AsString:='';
posmodule.CONFIGSBOUCHERY.AsString:='';
posmodule.CONFIGSSNACK.AsString:='';
posmodule.CONFIGSCAFETERIA.AsString:='';
posmodule.CONFIGSPATESSERIE.AsString:='';
posmodule.CONFIGSPIZZA.AsString:='';
posmodule.CONFIGSSHISHAZ.AsString:='';
posmodule.CONFIGSORDERCHEF.AsString:='';
posmodule.CONFIGS.post;
end;

end.
