Created
June 19, 2013 09:14
-
-
Save anonymous/5812904 to your computer and use it in GitHub Desktop.
Módulo de Formas de pago del programa de Gestión desde 0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit UFormasdePago; | |
{$R BOTONERA.RES} | |
interface | |
uses | |
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, IBDatabase, | |
MMSystem, //Para la botonera | |
NewPanelDB, //Para usar el NEwPanelDB | |
SPBBC, //Para TSpeedButtonBC | |
Lapelpanel, //Para paneles con solapa | |
MyDbIbMemo, //Para DbiMemo | |
TDbIbchkbox, //Para campos boolean en Firebird | |
Mask, DbEditDefault, //PAra usar los DbeditDefault en vez de los Dbedit normal | |
DBCBEXT, //Para usar el DbCombobox Extendido | |
GroupboxJL, //Para usar el CgoupBox especial | |
Dialogs, ComCtrls, ExtCtrls, Grids, DBGrids, StdCtrls, Spin, Buttons, DB, DBCtrls, | |
DBneweditjl; | |
type | |
TFFormasdePago = class(TForm) | |
PanelBotonera: TNewPanelDB; | |
SBBarraStatus: TStatusBar; | |
Panel1: TPanel; | |
Panel2: TPanel; | |
PanelDatos: TNewPanelDB; | |
PanelConfirmar: TNewPanelDB; | |
DsPrincipal: TDataSource; | |
SBPrimero: TSpeedButtonBC; | |
SBMenosx: TSpeedButtonBC; | |
SBMenos1: TSpeedButtonBC; | |
SBMas1: TSpeedButtonBC; | |
SBMasX: TSpeedButtonBC; | |
SBUltimo: TSpeedButtonBC; | |
SbNuevo: TSpeedButtonBC; | |
SbModificar: TSpeedButtonBC; | |
SbBorrar: TSpeedButtonBC; | |
SB_Salir: TSpeedButtonBC; | |
SBBuscar: TSpeedButtonBC; | |
SBImprimir: TSpeedButtonBC; | |
SBConfirmar: TSpeedButtonBC; | |
SBCancelar: TSpeedButtonBC; | |
Label14: TLabel; | |
SEMobeByX: TSpinEdit; | |
GBBuscar: TGroupBoxJL; | |
Ebusqueda: TEdit; | |
BLimpiar: TButton; | |
BBuscar: TButton; | |
BCerrar: TButton; | |
GBImprimir: TGroupBoxJL; | |
CBVistaPrevia: TCheckBox; | |
CBVerDialogo: TCheckBox; | |
BCerrarIMP: TButton; | |
Timer1: TTimer; | |
Label1: TLabel; | |
Label2: TLabel; | |
Label3: TLabel; | |
Label4: TLabel; | |
Label5: TLabel; | |
DBNCODIGO: TDBNewEditJL; | |
DBNFP: TDBNewEditJL; | |
DBNDiasPresentacion: TDBNewEditJL; | |
DBNDiasCobro: TDBNewEditJL; | |
DBNNumeroPagos: TDBNewEditJL; | |
Panel3: TPanel; | |
Panel4: TPanel; | |
Panel5: TPanel; | |
Panel6: TPanel; | |
DBGrid1: TDBGrid; | |
Panel7: TPanel; | |
DBGrid2: TDBGrid; | |
DSSecundario: TDataSource; | |
PanelDatos2: TNewPanelDB; | |
Label7: TLabel; | |
Label8: TLabel; | |
DBNNumerodias: TDBNewEditJL; | |
DBNPorcentaje: TDBNewEditJL; | |
Panel8: TPanel; | |
Label9: TLabel; | |
NewPanelDB1: TNewPanelDB; | |
Panelbotones2: TNewPanelDB; | |
SBC2Primer: TSpeedButtonBC; | |
SPC2retrocederx: TSpeedButtonBC; | |
SPC2retroceder1: TSpeedButtonBC; | |
SPC2avanzar1: TSpeedButtonBC; | |
SPC2avanzarx: TSpeedButtonBC; | |
SPC2ultimo: TSpeedButtonBC; | |
SPC2nuevo: TSpeedButtonBC; | |
SPC2Modificar: TSpeedButtonBC; | |
SPC2eliminar: TSpeedButtonBC; | |
Label6: TLabel; | |
SPC2busqueda: TSpeedButtonBC; | |
SPBMove2: TSpinEdit; | |
GbBuscar2: TGroupBoxJL; | |
EdBusqueda2: TEdit; | |
BLimpiar1: TButton; | |
Bbuscar2: TButton; | |
Bcerrar2: TButton; | |
procedure FormKeyPress(Sender: TObject; var Key: Char); | |
procedure SBPrimeroClick(Sender: TObject); | |
procedure SBMenosxClick(Sender: TObject); | |
procedure SBMenos1Click(Sender: TObject); | |
procedure SBMas1Click(Sender: TObject); | |
procedure SBMasXClick(Sender: TObject); | |
procedure SBUltimoClick(Sender: TObject); | |
procedure SbNuevoClick(Sender: TObject); | |
procedure SbModificarClick(Sender: TObject); | |
procedure SbBorrarClick(Sender: TObject); | |
procedure SBBuscarClick(Sender: TObject); | |
procedure BLimpiarClick(Sender: TObject); | |
procedure BBuscarClick(Sender: TObject); | |
procedure BCerrarClick(Sender: TObject); | |
procedure EbusquedaChange(Sender: TObject); | |
procedure SBImprimirClick(Sender: TObject); | |
procedure BCerrarIMPClick(Sender: TObject); | |
procedure SB_SalirClick(Sender: TObject); | |
procedure FormCreate(Sender: TObject); | |
procedure Timer1Timer(Sender: TObject); | |
procedure FormActivate(Sender: TObject); | |
procedure SBCancelarClick(Sender: TObject); | |
procedure SBConfirmarClick(Sender: TObject); | |
procedure FormClose(Sender: TObject; var Action: TCloseAction); | |
procedure SPC2nuevoClick(Sender: TObject); | |
procedure SBC2PrimerClick(Sender: TObject); | |
procedure SPC2retrocederxClick(Sender: TObject); | |
procedure SPC2retroceder1Click(Sender: TObject); | |
procedure SPC2avanzar1Click(Sender: TObject); | |
procedure SPC2avanzarxClick(Sender: TObject); | |
procedure SPC2ultimoClick(Sender: TObject); | |
procedure SPC2ModificarClick(Sender: TObject); | |
procedure SPC2eliminarClick(Sender: TObject); | |
procedure SPC2busquedaClick(Sender: TObject); | |
procedure BLimpiar1Click(Sender: TObject); | |
procedure Bbuscar2Click(Sender: TObject); | |
procedure Bcerrar2Click(Sender: TObject); | |
procedure EdBusqueda2Change(Sender: TObject); | |
procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; | |
DataCol: Integer; Column: TColumn; State: TGridDrawState); | |
procedure DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect; | |
DataCol: Integer; Column: TColumn; State: TGridDrawState); | |
private | |
{ Private declarations } | |
public | |
{ Public declarations } | |
end; | |
var | |
FFormasdePago: TFFormasdePago; | |
IBT:TIBTransaction; | |
VarINumeroPAgos:Integer; | |
VarBRepetir:Boolean; | |
implementation | |
{$R *.dfm} | |
uses UDM, Fun, FUN_DBGRID, UMENU, UProveedor; | |
procedure TFFormasdePago.Bbuscar2Click(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//**************************************************************[ Buscar ]****** | |
//------------------------------------------------------------------------------ | |
var Campo:string; | |
begin | |
Campo:='NUMERODEDIAS'; {Dato a rellenar por el progrmador con el nombre del campo en la busqueda} | |
DSSecundario.DataSet.Locate(Campo,EdBusqueda2.Text,[loCaseInsensitive,loPartialKey]); //locat multiple | |
end; | |
procedure TFFormasdePago.BBuscarClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//**************************************************************[ Buscar ]****** | |
//------------------------------------------------------------------------------ | |
var Campo:string; | |
begin | |
Campo:='FORMAPAGO'; {Dato a rellenar por el progrmador con el nombre del campo en la busqueda} | |
DSPrincipal.DataSet.Locate(Campo,Ebusqueda.Text,[loCaseInsensitive,loPartialKey]); | |
end; | |
procedure TFFormasdePago.Bcerrar2Click(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*****************************************************[ Cerrar Busqueda ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
BLimpiar1Click(Sender); | |
GbBuscar2.Visible:=False; | |
end; | |
procedure TFFormasdePago.BCerrarClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*****************************************************[ Cerrar Busqueda ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
BLimpiarClick(Sender); | |
GBBuscar.Visible:=False; | |
end; | |
procedure TFFormasdePago.BCerrarIMPClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//****************************************************[ Cerrar Imrprimir ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
GBImprimir.Visible:=False; | |
end; | |
procedure TFFormasdePago.BLimpiar1Click(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//**************************************************[ Limpia la busqueda ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
EdBusqueda2.Text:=''; | |
Bbuscar2Click(Sender); | |
EdBusqueda2.SetFocus; | |
end; | |
procedure TFFormasdePago.BLimpiarClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//**************************************************[ Limpia la busqueda ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
Ebusqueda.Text:=''; | |
BBuscarClick(Sender); | |
Ebusqueda.SetFocus; | |
end; | |
procedure TFFormasdePago.DBGrid1DrawColumnCell(Sender: TObject; | |
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); | |
//------------------------------------------------------------------------------ | |
//*******************************************************[ ZEbaro del Grid ]**** | |
//------------------------------------------------------------------------------ | |
begin | |
Zebrado(DSSecundario,DBGrid1, Rect, Column, State, COLOR1GRID,COLOR2GRID); | |
end; | |
procedure TFFormasdePago.DBGrid2DrawColumnCell(Sender: TObject; | |
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); | |
//------------------------------------------------------------------------------ | |
//*******************************************************[ ZEbaro del Grid ]**** | |
//------------------------------------------------------------------------------ | |
begin | |
Zebrado(DsPrincipal,DBGrid2, Rect, Column, State, COLOR1GRID,COLOR2GRID); | |
end; | |
procedure TFFormasdePago.EbusquedaChange(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*************************************[ Mientras se escribe en busqueda ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
BBuscarClick(sender); | |
end; | |
procedure TFFormasdePago.EdBusqueda2Change(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*************************************[ Mientras se escribe en busqueda ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
Bbuscar2Click(sender); | |
end; | |
procedure TFFormasdePago.FormActivate(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//********************************************[ Cuando se activa El form ]****** | |
// Lo que queremos que haga nuestro Form Cuando se Actiba | |
//------------------------------------------------------------------------------ | |
begin | |
//Carganmos las imagenes de los botones | |
SBPrimero.Glyph.Handle:=Loadbitmap(HInstance,'FIRST'); | |
SBMenosx.Glyph.Handle:=Loadbitmap(HInstance,'RETROCEDER'); | |
SBMenos1.Glyph.Handle:=Loadbitmap(HInstance,'PRIOR'); | |
SBMas1.Glyph.Handle:=Loadbitmap(HInstance,'NEXT'); | |
SBMasX.Glyph.Handle:=Loadbitmap(HInstance,'AVANZAR'); | |
SBUltimo.Glyph.Handle:=Loadbitmap(HInstance,'LAST'); | |
SbNuevo.Glyph.Handle:=Loadbitmap(HInstance,'NUEVO'); | |
SbModificar.Glyph.Handle:=Loadbitmap(HInstance,'EDIT'); | |
SbBorrar.Glyph.Handle:=Loadbitmap(HInstance,'BORRAR'); | |
SB_Salir.Glyph.Handle:=Loadbitmap(HInstance,'SALIR'); | |
SBBuscar.Glyph.Handle:=Loadbitmap(HInstance,'BUSCAR'); | |
SBImprimir.Glyph.Handle:=Loadbitmap(HInstance,'IMPRIMIR'); | |
SBConfirmar.Glyph.Handle:=Loadbitmap(HInstance,'CHECKROUND'); | |
SBCancelar.Glyph.Handle:=Loadbitmap(HInstance,'CANCEL'); | |
//Para el segundo grupo | |
SBC2Primer.Glyph.Handle:=Loadbitmap(HInstance,'FIRST'); | |
SPC2retrocederx.Glyph.Handle:=Loadbitmap(HInstance,'RETROCEDER'); | |
SPC2retroceder1.Glyph.Handle:=Loadbitmap(HInstance,'PRIOR'); | |
SPC2avanzar1.Glyph.Handle:=Loadbitmap(HInstance,'NEXT'); | |
SPC2avanzarx.Glyph.Handle:=Loadbitmap(HInstance,'AVANZAR'); | |
SPC2ultimo.Glyph.Handle:=Loadbitmap(HInstance,'LAST'); | |
SPC2nuevo.Glyph.Handle:=Loadbitmap(HInstance,'NUEVO'); | |
SPC2Modificar.Glyph.Handle:=Loadbitmap(HInstance,'EDIT'); | |
SPC2eliminar.Glyph.Handle:=Loadbitmap(HInstance,'BORRAR'); | |
SPC2busqueda.Glyph.Handle:=Loadbitmap(HInstance,'BUSCAR'); | |
if Timer1.Enabled=false then Timer1.Enabled:=True; | |
//Ponemos el Juego de colores de mis NewPanelDB | |
PanelBotonera.ColorNotActive:=COLORPANELACT; | |
PanelBotonera.ActiveColor:=COLORPANELNOACT; | |
PanelDatos.ActiveColor:=COLORPANELACT; | |
PanelDatos.ColorNotActive:=COLORPANELNOACT; | |
PanelConfirmar.ActiveColor:=COLORPANELACT; | |
PanelConfirmar.ColorNotActive:=COLORPANELNOACT; | |
//Pare el detalle | |
Panelbotones2.ColorNotActive:=COLORPANELACT; | |
Panelbotones2.ActiveColor:=COLORPANELNOACT; | |
PanelDatos2.ActiveColor:=COLORPANELACT; | |
PanelDatos2.ColorNotActive:=COLORPANELNOACT; | |
end; | |
procedure TFFormasdePago.FormClose(Sender: TObject; var Action: TCloseAction); | |
//------------------------------------------------------------------------------ | |
//*************************************************[ Al Cerrarse El Form ]****** | |
// Cerramos todos los procesos para que no consuman memoria y posibles errores | |
//------------------------------------------------------------------------------ | |
begin | |
if Timer1.Enabled=true then Timer1.Enabled:=False; | |
if (VarSNomMod='PROVEEDORES') and (FProveedor.DsPrincipal.DataSet.state in [dsEdit,dsInsert]) then | |
begin | |
FProveedor.DBNCodigoFormaPago.Field.Value:=DBNFP.Text; //Pnemos la forma de pago elegida | |
FProveedor.DBNCodigoFormaPago.SetFocus; //Damos el focno nuevamente al campo | |
end; | |
end; | |
procedure TFFormasdePago.FormCreate(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//***************************************************[ Al Crearse el Fom ]****** | |
// Cosas que queremos que haga según se inicie el Form | |
//------------------------------------------------------------------------------ | |
begin | |
IBT:=DM.IBTransaction1; // Aquí especificar el modulo y el IBTransaction a usar | |
{Cosas que queremos que haga según se inicie el Form} | |
end; | |
procedure TFFormasdePago.FormKeyPress(Sender: TObject; var Key: Char); | |
//------------------------------------------------------------------------------ | |
//************************************************[ Al pulsar una tecla ]****** | |
// Al pulsar la tecla salta al foco del siguiente componente, si esta admitido | |
//------------------------------------------------------------------------------ | |
begin | |
if (Key = #13) then {Si se ha pulsado enter } | |
if (ActiveControl is TEdit) | |
or (ActiveControl is TDBEdit) | |
or (ActiveControl is TDBComboBox) then | |
begin | |
Key := #0; { anula la puulsación } | |
Perform(WM_NEXTDLGCTL, 0, 0); { mueve al próximo control } | |
end | |
end; | |
procedure TFFormasdePago.SbBorrarClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*******************************************[ Borrar el Actual Registro ]****** | |
//------------------------------------------------------------------------------ | |
begin //Cambiar por el mensaje elegido | |
if (MessageBox(0, '¿Esta seguro de eliminar el registro actual?', | |
'Eliminar Registro', MB_ICONSTOP or MB_YESNO or MB_DEFBUTTON2) = ID_No) then abort | |
else begin | |
DSPrincipal.DataSet.Delete; | |
ShowMessage('El registro ha sido eliminado'); | |
IBT.CommitRetaining; | |
end; | |
end; | |
procedure TFFormasdePago.SBBuscarClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//******************************************************[ Abrir Busqueda ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
GBBuscar.Visible:=True; | |
Ebusqueda.SetFocus; | |
end; | |
procedure TFFormasdePago.SBC2PrimerClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//***********************************************[ Ir al Primer Registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSSecundario.DataSet.First; | |
end; | |
procedure TFFormasdePago.SBCancelarClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*****************************************************[ Cancelar Proceso]****** | |
//------------------------------------------------------------------------------ | |
begin | |
if DsPrincipal.DataSet.State in [dsEdit,dsInsert] then | |
begin | |
DSPrincipal.DataSet.Cancel; | |
if NewPanelDB1.Enabled=False then NewPanelDB1.Enabled:=True; | |
end else | |
begin | |
DSSecundario.DataSet.Cancel; | |
if PanelBotonera.Enabled=False then PanelBotonera.Enabled:=True; | |
end; | |
IBT.RollbackRetaining; //Donde IBT es el nombre de su Ibtrasaction, con ruta | |
end; | |
procedure TFFormasdePago.SBConfirmarClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//********************************************************[ Grabar datos ]****** | |
//------------------------------------------------------------------------------ | |
var VarBDSPrincipalActivo:Boolean; | |
begin | |
try | |
if (FFormasdePago.Active) then | |
begin | |
if DsPrincipal.DataSet.State in [dsEdit,dsInsert] then | |
begin | |
if (DBNCODIGO.Text<>'') and (DBNFP.Text<>'') and (DBNNumeroPagos.Text<>'') then | |
begin | |
VarBDSPrincipalActivo:=True; | |
if DBNDiasPresentacion.Text='' then DBNDiasPresentacion.Text:='0'; | |
if DBNDiasCobro.Text='' then DBNDiasCobro.Text:='0'; | |
VarINumeroPAgos:=DBNNumeroPagos.Field.Value; | |
if DBNNumeroPagos.Field.Value>1 then VarBRepetir:=true | |
else VarBRepetir:=False; | |
DSPrincipal.DataSet.Post; | |
if NewPanelDB1.Enabled=False then NewPanelDB1.Enabled:=True; | |
end else ShowMessage('Debe rellenar los campos Códigó, foma de pago y Número de pagos, como mínimo para poder grabar'); | |
end else | |
begin | |
if (DBNNumerodias.Text<>'') and (DBNPorcentaje.Text<>'') then | |
begin | |
if VarINumeroPAgos>1 then VarINumeroPAgos:=VarINumeroPAgos-1; //Si el número de pagos es mayor que 1 descontamos | |
if VarINumeroPAgos=0 then VarBRepetir:=False; | |
VarBDSPrincipalActivo:=false; | |
DSSecundario.DataSet.FieldByName('CODIGOFORMADEPAGO').value:=DBNCODIGO.Field.Value; | |
DSSecundario.DataSet.Post; | |
if PanelBotonera.Enabled=False then PanelBotonera.Enabled:=True; | |
end else ShowMessage('Debe rellenar los campos CNúmero de días y porcentaje de pago, para poder grabar'); | |
end; | |
IBT.CommitRetaining; //Donde IBT es el nombre de su Ibtrasaction, con ruta | |
if VarBRepetir=true then //Si existen más de 1 pago para seguir metiendo hasta que cambie | |
begin | |
Label9.Caption:='Pagos pendientes: ['+IntToStr(VarINumeroPAgos)+']'; | |
SPC2nuevoClick(Sender); | |
if SB_Salir.Enabled=False then SB_Salir.Enabled:=True; | |
end else Label9.Caption:=''; | |
end; | |
except | |
on E: Exception do | |
begin | |
MessageBeep(1000); | |
ShowMessage('Se ha producido un error y el proceso no se ha podido terminar Unidad:[ UFormasdePago ] Modulo:[ Grabar ]' + Chr(13) + Chr(13) | |
+ 'Clase de error: ' + E.ClassName + Chr(13) + Chr(13) | |
+ 'Mensaje del error:' + E.Message+Chr(13) + Chr(13) | |
+ ' '+Chr(13) + Chr(13) | |
+ 'El proceso ha quedado interrumpido'); | |
if VarBDSPrincipalActivo then | |
begin | |
DSPrincipal.DataSet.Cancel; | |
if NewPanelDB1.Enabled=False then NewPanelDB1.Enabled:=True; | |
end else | |
begin | |
DSSecundario.DataSet.cancel; | |
if PanelBotonera.Enabled=False then PanelBotonera.Enabled:=True; | |
end; | |
IBT.RollbackRetaining; //Donde IBT es el nombre de su Ibtrasaction, con ruta | |
end; | |
end; | |
end; | |
procedure TFFormasdePago.SBImprimirClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//******************************************************[ Abrir Imprimir ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
GBImprimir.Visible:=True; | |
end; | |
procedure TFFormasdePago.SBMas1Click(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*************************************************[ Avanzar un registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSPrincipal.DataSet.Next; | |
end; | |
procedure TFFormasdePago.SBMasXClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*************************************************[ Avanzar x Registros ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSPrincipal.DataSet.MoveBy(SEMobeByX.Value); | |
end; | |
procedure TFFormasdePago.SBMenos1Click(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//***********************************************[ Retroceder 1 registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSPrincipal.DataSet.Prior; | |
end; | |
procedure TFFormasdePago.SBMenosxClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//**********************************************[ Retroceder x Registros ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSPrincipal.DataSet.MoveBy(-SEMobeByX.Value); | |
end; | |
procedure TFFormasdePago.SbModificarClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*******************************************[ Editar el actual registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
if DsPrincipal.DataSet.IsEmpty<>true then | |
begin | |
NewPanelDB1.Enabled:=False; //Sobre el que esta la botonera del detalle | |
PanelConfirmar.DataSource:=DsPrincipal; | |
DSPrincipal.DataSet.Edit; | |
DBNCODIGO.SetFocus; | |
end else ShowMessage('No hay tregistros disponibles para editar') | |
end; | |
procedure TFFormasdePago.SbNuevoClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*******************************************[ Creamos un nuevo registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
PanelConfirmar.DataSource:=DsPrincipal; | |
NewPanelDB1.Enabled:=False; //Sobre el que esta la botonera del detalle | |
DSPrincipal.DataSet.Insert; | |
VarINumeroPAgos:=0; | |
DBNCODIGO.SetFocus; | |
end; | |
procedure TFFormasdePago.SBPrimeroClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//***********************************************[ Ir al Primer Registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSPrincipal.DataSet.First; | |
end; | |
procedure TFFormasdePago.SBUltimoClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//***********************************************[ Ir al último registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSPrincipal.DataSet.Last; | |
end; | |
procedure TFFormasdePago.SB_SalirClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//******************************************************[ Salir Del Form ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
FFormasdePago.Close; | |
end; | |
procedure TFFormasdePago.SPC2avanzar1Click(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*************************************************[ Avanzar un registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSSecundario.DataSet.Next; | |
end; | |
procedure TFFormasdePago.SPC2avanzarxClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*************************************************[ Avanzar x Registros ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSSecundario.DataSet.MoveBy(SPBMove2.Value); | |
end; | |
procedure TFFormasdePago.SPC2busquedaClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//******************************************************[ Abrir Busqueda ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
GbBuscar2.Visible:=True; | |
EdBusqueda2.SetFocus; | |
end; | |
procedure TFFormasdePago.SPC2eliminarClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*******************************************[ Borrar el Actual Registro ]****** | |
//------------------------------------------------------------------------------ | |
begin //Cambiar por el mensaje elegido | |
if (MessageBox(0, '¿Esta seguro de eliminar el registro actual?', | |
'Eliminar Registro', MB_ICONSTOP or MB_YESNO or MB_DEFBUTTON2) = ID_No) then abort | |
else begin | |
DSSecundario.DataSet.Delete; | |
ShowMessage('El registro ha sido eliminado'); | |
IBT.CommitRetaining; | |
end; | |
end; | |
procedure TFFormasdePago.SPC2ModificarClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*******************************************[ Editar el actual registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
if DSSecundario.DataSet.IsEmpty<>true then | |
begin | |
PanelConfirmar.DataSource:=DSSecundario; | |
PanelBotonera.Enabled:=False; | |
DSSecundario.DataSet.Edit; | |
DBNNumerodias.SetFocus; | |
end else ShowMessage('No hay tregistros disponibles para editar') | |
end; | |
procedure TFFormasdePago.SPC2nuevoClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*******************************************[ Creamos un nuevo registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
PanelConfirmar.DataSource:=DSSecundario; | |
PanelBotonera.Enabled:=False; | |
DSSecundario.DataSet.Insert; | |
DBNNumerodias.SetFocus; | |
end; | |
procedure TFFormasdePago.SPC2retroceder1Click(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//***********************************************[ Retroceder 1 registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSSecundario.DataSet.Prior; | |
end; | |
procedure TFFormasdePago.SPC2retrocederxClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//**********************************************[ Retroceder x Registros ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSSecundario.DataSet.MoveBy(-SPBMove2.Value); | |
end; | |
procedure TFFormasdePago.SPC2ultimoClick(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//***********************************************[ Ir al último registro ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
DSSecundario.DataSet.Last; | |
end; | |
procedure TFFormasdePago.Timer1Timer(Sender: TObject); | |
//------------------------------------------------------------------------------ | |
//*************************************************[ El evento del Timer ]****** | |
//------------------------------------------------------------------------------ | |
begin | |
SBBarraStatus.Panels[2].Text:=TimeToStr(now); | |
if SBBarraStatus.Panels[1].Text<>DateToStr(Now) then SBBarraStatus.Panels[1].Text:=DateToStr(Now); | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment