#include <registroiva.h>
Inheritance diagram for RegistroIva:

Public Member Functions | |
| void | setLineas (SubForm2Bc *l) |
| RegistroIva (Empresa *, QWidget *) | |
| QString | idregistroiva () |
| QString | contrapartida () |
| QString | baseimp () |
| QString | iva () |
| QString | ffactura () |
| QString | femisionregistroiva () |
| QString | factura () |
| QString | idborrador () |
| QString | incregistro () |
| QString | regularizacion () |
| QString | plan349 () |
| QString | numorden () |
| QString | cif () |
| QString | idfpago () |
| QString | factemitida () |
| QString | rectificaaregistroiva () |
| QString | serieregistroiva () |
| void | setidregistroiva (const QString &val) |
| void | setcontrapartida (const QString &val) |
| void | setbaseimp (const QString &val) |
| void | setiva (const QString &val) |
| void | setffactura (const QString &val) |
| void | setfactura (const QString &val) |
| void | setidborrador (const QString &val) |
| void | setincregistro (const QString &val) |
| void | setregularizacion (const QString &val) |
| void | setplan349 (const QString &val) |
| void | setnumorden (const QString &val) |
| void | setcif (const QString &val) |
| void | setidfpago (const QString &val) |
| void | setfactemitida (const QString &val) |
| void | setrectificaaregistroiva (const QString &val) |
| void | setfemisionregistroiva (const QString &val) |
| void | setserieregistroiva (const QString &val) |
| virtual void | pintaidregistroiva (const QString &) |
| virtual void | pintacontrapartida (const QString &) |
| virtual void | pintabaseimp (const QString &) |
| virtual void | pintaiva (const QString &) |
| virtual void | pintaffactura (const QString &) |
| virtual void | pintafactura (const QString &) |
| virtual void | pintaidborrador (const QString &) |
| virtual void | pintaincregistro (const QString &) |
| virtual void | pintaregularizacion (const QString &) |
| virtual void | pintaplan349 (const QString &) |
| virtual void | pintanumorden (const QString &) |
| virtual void | pintacif (const QString &) |
| virtual void | pintaidfpago (const QString &) |
| virtual void | pintafactemitida (const QString &) |
| virtual void | pintarectificaaregistroiva (const QString &) |
| virtual void | pintafemisionregistroiva (const QString &) |
| virtual void | pintaserieregistroiva (const QString &) |
| virtual | ~RegistroIva () |
| virtual int | cargar (QString) |
| Esta función carga un presupuesto. | |
| virtual void | pintaRegistroIva () |
| virtual int | guardar () |
| virtual int | borrar () |
| virtual void | calculaypintatotales () |
| virtual void | recalculaIva () |
| void | vaciaRegistroIva () |
| int | buscaborradorservicio (int) |
| Busca la cuenta del servicio. | |
| int | buscaborradorcliente (int) |
| Busca la cuenta del cliente o del proveedor en el apunte que se ha seleccionado. | |
| int | buscaborradoriva (int) |
| void | inicializa1 (int) |
| void | buscafecha (int) |
| SLOT que se dispara cuando se ha hecho el botón de búsqueda de una fecha. | |
| void | buscaNumFactura (int) |
Protected Attributes | |
| SubForm2Bc * | m_lineas |
Definition at line 36 of file registroiva.h.
| comp | ||
| parent |
Definition at line 39 of file registroiva.cpp.
References _depura(), DBRecord::addDBCampo(), DBCampo::DBboolean, DBCampo::DBdate, DBCampo::DBint, DBCampo::DBNothing, DBCampo::DBNotNull, DBCampo::DBnumeric, DBCampo::DBPrimaryKey, DBCampo::DBvarchar, DBRecord::setDBCampoId(), Ficha::setDBTableName(), and Ficha::setTitleName().
00039 : FichaBc(comp, parent) { 00040 _depura("RegistroIva::RegistroIva", 0); 00041 setTitleName(tr("Registro IVA")); 00042 setDBTableName("registroiva"); 00043 setDBCampoId("idregistroiva"); 00044 addDBCampo("idregistroiva", DBCampo::DBint, DBCampo::DBPrimaryKey, "Identificador"); 00045 addDBCampo("contrapartida", DBCampo::DBint, DBCampo::DBNotNull, "Contrapartida"); 00046 addDBCampo("baseimp", DBCampo::DBnumeric, DBCampo::DBNotNull, "Base Imponible"); 00047 addDBCampo("iva", DBCampo::DBnumeric, DBCampo::DBNotNull, "Iva"); 00048 addDBCampo("ffactura", DBCampo::DBdate, DBCampo::DBNotNull, "Fecha Factura"); 00049 addDBCampo("idborrador", DBCampo::DBint, DBCampo::DBNotNull, "Borrador"); 00050 addDBCampo("numorden", DBCampo::DBint, DBCampo::DBNotNull, "Orden"); 00051 addDBCampo("cif", DBCampo::DBvarchar, DBCampo::DBNotNull, "CIF"); 00052 addDBCampo("idfpago", DBCampo::DBint, DBCampo::DBNothing, "Forma de Pago"); 00053 addDBCampo("incregistro", DBCampo::DBboolean, DBCampo::DBNotNull, "incregistro"); 00054 addDBCampo("regularizacion", DBCampo::DBboolean, DBCampo::DBNothing, "regularizacion"); 00055 addDBCampo("plan349", DBCampo::DBboolean, DBCampo::DBNothing, "plan 349"); 00056 addDBCampo("factemitida", DBCampo::DBboolean, DBCampo::DBNotNull, "Factura Emitida"); 00057 addDBCampo("rectificaaregistroiva", DBCampo::DBint, DBCampo::DBNothing, "Rectifica a"); 00058 addDBCampo("factura", DBCampo::DBvarchar, DBCampo::DBNothing, "Factura"); 00059 addDBCampo("femisionregistroiva", DBCampo::DBdate, DBCampo::DBNotNull, "Fecha Emision"); 00060 addDBCampo("serieregistroiva", DBCampo::DBvarchar, DBCampo::DBNothing, "Serie"); 00061 _depura("END RegistroIva::RegistroIva", 0); 00062 }
| RegistroIva::~RegistroIva | ( | ) | [virtual] |
Definition at line 68 of file registroiva.cpp.
References _depura().
00068 { 00069 _depura("RegistroIva::~RegistroIva", 0); 00070 _depura("RegistroIva::~RegistroIva", 0); 00071 }
| void RegistroIva::setLineas | ( | SubForm2Bc * | l | ) | [inline] |
Definition at line 41 of file registroiva.h.
References m_lineas.
Referenced by RegistroIvaView::RegistroIvaView().
00041 { 00042 m_lineas = l; 00043 };
| QString RegistroIva::idregistroiva | ( | ) | [inline] |
Definition at line 45 of file registroiva.h.
References DBRecord::DBvalue().
00045 { 00046 return DBvalue("idregistroiva"); 00047 };
| QString RegistroIva::contrapartida | ( | ) | [inline] |
Definition at line 48 of file registroiva.h.
References DBRecord::DBvalue().
Referenced by RegistroIvaView::on_mui_generarPrevisiones_clicked().
00048 { 00049 return DBvalue("contrapartida"); 00050 };
| QString RegistroIva::baseimp | ( | ) | [inline] |
Definition at line 51 of file registroiva.h.
References DBRecord::DBvalue().
Referenced by RegistroIvaView::on_mui_generarPrevisiones_clicked(), and RegistroIvaView::pintaiva().
00051 { 00052 return DBvalue("baseimp"); 00053 };
| QString RegistroIva::iva | ( | ) | [inline] |
Definition at line 54 of file registroiva.h.
References DBRecord::DBvalue().
Referenced by RegistroIvaView::on_mui_generarPrevisiones_clicked(), RegistroIvaView::pintabaseimp(), and RegistroIvaView::recalculaIva().
00054 { 00055 return DBvalue("iva"); 00056 };
| QString RegistroIva::ffactura | ( | ) | [inline] |
Definition at line 57 of file registroiva.h.
References DBRecord::DBvalue().
Referenced by RegistroIvaView::on_mui_generarPrevisiones_clicked().
00057 { 00058 return DBvalue("ffactura"); 00059 };
| QString RegistroIva::femisionregistroiva | ( | ) | [inline] |
Definition at line 60 of file registroiva.h.
References DBRecord::DBvalue().
00060 { 00061 return DBvalue("femisionregistroiva"); 00062 };
| QString RegistroIva::factura | ( | ) | [inline] |
Definition at line 63 of file registroiva.h.
References DBRecord::DBvalue().
Referenced by RegistroIvaView::cargar().
00063 { 00064 return DBvalue("factura"); 00065 };
| QString RegistroIva::idborrador | ( | ) | [inline] |
Definition at line 66 of file registroiva.h.
References DBRecord::DBvalue().
Referenced by inicializa1().
00066 { 00067 return DBvalue("idborrador"); 00068 };
| QString RegistroIva::incregistro | ( | ) | [inline] |
Definition at line 69 of file registroiva.h.
References DBRecord::DBvalue().
00069 { 00070 return DBvalue("incregistro"); 00071 };
| QString RegistroIva::regularizacion | ( | ) | [inline] |
Definition at line 72 of file registroiva.h.
References DBRecord::DBvalue().
00072 { 00073 return DBvalue("regularizacion"); 00074 };
| QString RegistroIva::plan349 | ( | ) | [inline] |
Definition at line 75 of file registroiva.h.
References DBRecord::DBvalue().
00075 { 00076 return DBvalue("plan349"); 00077 };
| QString RegistroIva::numorden | ( | ) | [inline] |
Definition at line 78 of file registroiva.h.
References DBRecord::DBvalue().
00078 { 00079 return DBvalue("numorden"); 00080 };
| QString RegistroIva::cif | ( | ) | [inline] |
Definition at line 81 of file registroiva.h.
References DBRecord::DBvalue().
00081 { 00082 return DBvalue("cif"); 00083 };
| QString RegistroIva::idfpago | ( | ) | [inline] |
Definition at line 84 of file registroiva.h.
References DBRecord::DBvalue().
00084 { 00085 return DBvalue("idfpago"); 00086 };
| QString RegistroIva::factemitida | ( | ) | [inline] |
Definition at line 87 of file registroiva.h.
References DBRecord::DBvalue().
00087 { 00088 return DBvalue("factemitida"); 00089 };
| QString RegistroIva::rectificaaregistroiva | ( | ) | [inline] |
Definition at line 90 of file registroiva.h.
References DBRecord::DBvalue().
00090 { 00091 return DBvalue("rectificaaregistroiva"); 00092 };
| QString RegistroIva::serieregistroiva | ( | ) | [inline] |
Definition at line 93 of file registroiva.h.
References DBRecord::DBvalue().
00093 { 00094 return DBvalue("serieregistroiva"); 00095 };
| void RegistroIva::setidregistroiva | ( | const QString & | val | ) | [inline] |
Definition at line 96 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by guardar().
00096 { 00097 setDBvalue("idregistroiva", val); 00098 };
| void RegistroIva::setcontrapartida | ( | const QString & | val | ) | [inline] |
Definition at line 99 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by buscaborradorcliente(), and RegistroIvaView::guardar().
00099 { 00100 setDBvalue("contrapartida", val); 00101 };
| void RegistroIva::setbaseimp | ( | const QString & | val | ) | [inline] |
Definition at line 102 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by buscaborradorservicio(), RegistroIvaView::guardar(), and RegistroIvaView::recalculaIva().
00102 { 00103 setDBvalue("baseimp", val); 00104 };
| void RegistroIva::setiva | ( | const QString & | val | ) | [inline] |
Definition at line 105 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by RegistroIvaView::guardar(), and RegistroIvaView::recalculaIva().
00105 { 00106 setDBvalue("iva", val); 00107 };
| void RegistroIva::setffactura | ( | const QString & | val | ) | [inline] |
Definition at line 108 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by buscafecha(), and RegistroIvaView::guardar().
00108 { 00109 setDBvalue("ffactura", val); 00110 };
| void RegistroIva::setfactura | ( | const QString & | val | ) | [inline] |
Definition at line 111 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by buscaNumFactura(), and RegistroIvaView::guardar().
00111 { 00112 setDBvalue("factura", val); 00113 };
| void RegistroIva::setidborrador | ( | const QString & | val | ) | [inline] |
Definition at line 114 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by inicializa1().
00114 { 00115 setDBvalue("idborrador", val); 00116 };
| void RegistroIva::setincregistro | ( | const QString & | val | ) | [inline] |
Definition at line 117 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by RegistroIvaView::guardar().
00117 { 00118 setDBvalue("incregistro", val); 00119 };
| void RegistroIva::setregularizacion | ( | const QString & | val | ) | [inline] |
Definition at line 120 of file registroiva.h.
References DBRecord::setDBvalue().
00120 { 00121 setDBvalue("regularizacion", val); 00122 };
| void RegistroIva::setplan349 | ( | const QString & | val | ) | [inline] |
Definition at line 123 of file registroiva.h.
References DBRecord::setDBvalue().
00123 { 00124 setDBvalue("plan349", val); 00125 };
| void RegistroIva::setnumorden | ( | const QString & | val | ) | [inline] |
Definition at line 126 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by buscaNumFactura(), and RegistroIvaView::guardar().
00126 { 00127 setDBvalue("numorden", val); 00128 };
| void RegistroIva::setcif | ( | const QString & | val | ) | [inline] |
Definition at line 129 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by buscaborradorcliente(), and RegistroIvaView::guardar().
00129 { 00130 setDBvalue("cif", val); 00131 };
| void RegistroIva::setidfpago | ( | const QString & | val | ) | [inline] |
Definition at line 132 of file registroiva.h.
References DBRecord::setDBvalue().
00132 { 00133 setDBvalue("idfpago", val); 00134 };
| void RegistroIva::setfactemitida | ( | const QString & | val | ) | [inline] |
Definition at line 135 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by buscaborradorcliente(), and RegistroIvaView::guardar().
00135 { 00136 setDBvalue("factemitida", val); 00137 };
| void RegistroIva::setrectificaaregistroiva | ( | const QString & | val | ) | [inline] |
Definition at line 138 of file registroiva.h.
References DBRecord::setDBvalue().
00138 { 00139 setDBvalue("rectificaaregistroiva", val); 00140 };
| void RegistroIva::setfemisionregistroiva | ( | const QString & | val | ) | [inline] |
Definition at line 141 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by buscafecha(), and RegistroIvaView::guardar().
00141 { 00142 setDBvalue("femisionregistroiva", val); 00143 };
| void RegistroIva::setserieregistroiva | ( | const QString & | val | ) | [inline] |
Definition at line 144 of file registroiva.h.
References DBRecord::setDBvalue().
Referenced by buscaNumFactura(), and RegistroIvaView::guardar().
00144 { 00145 setDBvalue("serieregistroiva", val); 00146 };
| virtual void RegistroIva::pintaidregistroiva | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 147 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00147 { 00148 _depura("funcion no implementada", 2); 00149 };
| virtual void RegistroIva::pintacontrapartida | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 150 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00150 { 00151 _depura("funcion no implementada", 2); 00152 };
| virtual void RegistroIva::pintabaseimp | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 153 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00153 { 00154 _depura("funcion no implementada", 2); 00155 };
| virtual void RegistroIva::pintaiva | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 156 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00156 { 00157 _depura("funcion no implementada", 2); 00158 };
| virtual void RegistroIva::pintaffactura | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 159 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00159 { 00160 _depura("funcion no implementada", 2); 00161 };
| virtual void RegistroIva::pintafactura | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 162 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00162 { 00163 _depura("funcion no implementada", 2); 00164 };
| virtual void RegistroIva::pintaidborrador | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 165 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00165 { 00166 _depura("funcion no implementada", 2); 00167 };
| virtual void RegistroIva::pintaincregistro | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 168 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00168 { 00169 _depura("funcion no implementada", 2); 00170 };
| virtual void RegistroIva::pintaregularizacion | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 171 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00171 { 00172 _depura("funcion no implementada", 2); 00173 };
| virtual void RegistroIva::pintaplan349 | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 174 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00174 { 00175 _depura("funcion no implementada", 2); 00176 };
| virtual void RegistroIva::pintanumorden | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 177 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00177 { 00178 _depura("funcion no implementada", 2); 00179 };
| virtual void RegistroIva::pintacif | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 180 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00180 { 00181 _depura("funcion no implementada", 2); 00182 };
| virtual void RegistroIva::pintaidfpago | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 183 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00183 { 00184 _depura("funcion no implementada", 2); 00185 };
| virtual void RegistroIva::pintafactemitida | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 186 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00186 { 00187 _depura("funcion no implementada", 2); 00188 };
| virtual void RegistroIva::pintarectificaaregistroiva | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 189 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00189 { 00190 _depura("funcion no implementada", 2); 00191 };
| virtual void RegistroIva::pintafemisionregistroiva | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 192 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00192 { 00193 _depura("funcion no implementada", 2); 00194 };
| virtual void RegistroIva::pintaserieregistroiva | ( | const QString & | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 195 of file registroiva.h.
References _depura().
Referenced by pintaRegistroIva().
00195 { 00196 _depura("funcion no implementada", 2); 00197 };
| int RegistroIva::cargar | ( | QString | id | ) | [virtual] |
Esta función carga un presupuesto.
| id |
Tratamiento de excepciones.
Reimplemented from Ficha.
Reimplemented in RegistroIvaView.
Definition at line 147 of file registroiva.cpp.
References _depura(), postgresiface2::cargacursor(), DBRecord::DBload(), dialogChanges::dialogChanges_cargaInicial(), FichaBc::empresaBase(), cursor2::eof(), and cursor2::error().
Referenced by RegistroIvaView::cargar(), and inicializa1().
00147 { 00148 _depura("RegistroIva::cargaRegistroIva", 0); 00149 int error = 0; 00150 QString query = "SELECT * FROM registroiva WHERE idregistroiva = " + id; 00151 cursor2 *cur= empresaBase()->cargacursor(query); 00152 00153 if (cur->error()) error = 1; 00154 00155 if (!cur->eof()) { 00156 DBload(cur); 00157 } // end if 00158 00159 delete cur; 00160 00162 if (error) { 00163 _depura("Error en la carga del registro\n", 0); 00164 return -1; 00165 } // end if 00166 00167 dialogChanges_cargaInicial(); 00168 _depura("END RegistroIva::cargaRegistroIva", 0); 00169 return 0; 00170 }
| void RegistroIva::pintaRegistroIva | ( | ) | [virtual] |
Definition at line 118 of file registroiva.cpp.
References _depura(), calculaypintatotales(), DBRecord::DBvalue(), pintabaseimp(), pintacif(), pintacontrapartida(), pintafactemitida(), pintafactura(), pintafemisionregistroiva(), pintaffactura(), pintaidborrador(), pintaidfpago(), pintaidregistroiva(), pintaincregistro(), pintaiva(), pintanumorden(), pintaplan349(), pintarectificaaregistroiva(), pintaregularizacion(), and pintaserieregistroiva().
Referenced by inicializa1().
00118 { 00119 _depura("RegistroIva::pintaRegistroIva", 0); 00120 pintaidregistroiva(DBvalue("idregistroiva")); 00121 pintacontrapartida(DBvalue("contrapartida")); 00122 pintabaseimp(DBvalue("baseimp")); 00123 pintaiva(DBvalue("iva")); 00124 pintaffactura(DBvalue("ffactura")); 00125 pintafactura(DBvalue("factura")); 00126 pintaidborrador(DBvalue("idborrador")); 00127 pintaincregistro(DBvalue("incregistro")); 00128 pintaregularizacion(DBvalue("regularizacion")); 00129 pintaplan349(DBvalue("plan349")); 00130 pintanumorden(DBvalue("numorden")); 00131 pintacif(DBvalue("cif")); 00132 pintaidfpago(DBvalue("idfpago")); 00133 pintafactemitida(DBvalue("factemitida")); 00134 pintarectificaaregistroiva(DBvalue("rectificaaregistroiva")); 00135 pintafemisionregistroiva(DBvalue("femisionregistroiva")); 00136 pintaserieregistroiva(DBvalue("serieregistroiva")); 00137 calculaypintatotales(); 00138 _depura("END RegistroIva::pintaRegistroIva", 0); 00139 }
| int RegistroIva::guardar | ( | ) | [virtual] |
| return |
Reimplemented from Ficha.
Reimplemented in RegistroIvaView.
Definition at line 177 of file registroiva.cpp.
References _depura(), DBRecord::DBsave(), and setidregistroiva().
Referenced by RegistroIvaView::guardar().
00177 { 00178 _depura("RegistroIva::guardaRegistroIva", 0); 00179 QString id; 00180 try { 00181 DBsave(id); 00182 setidregistroiva(id); 00183 } catch (...) { 00184 _depura("RegistroIva::guardar Error al guardar", 2); 00185 throw -1; 00186 } // end try 00187 _depura("END RegistroIva::guardaRegistroIva", 0); 00188 return 0; 00189 }
| int RegistroIva::borrar | ( | ) | [virtual] |
Reimplemented from Ficha.
Reimplemented in RegistroIvaView.
Definition at line 78 of file registroiva.cpp.
References _depura(), postgresiface2::begin(), postgresiface2::commit(), DBRecord::DBvalue(), dialogChanges::dialogChanges_cargaInicial(), postgresiface2::ejecuta(), FichaBc::empresaBase(), and postgresiface2::rollback().
Referenced by RegistroIvaView::borrar().
00078 { 00079 _depura("RegistroIva::borraRegistroIva", 0); 00080 if (DBvalue("idregistroiva") != "") { 00081 empresaBase()->begin(); 00082 try { 00083 int error = empresaBase()->ejecuta("DELETE FROM iva WHERE idregistroiva = " + DBvalue("idregistroiva")); 00084 00085 if (error) throw -1; 00086 00087 error = empresaBase()->ejecuta("DELETE FROM registroiva WHERE idregistroiva = " + DBvalue("idregistroiva")); 00088 00089 if (error) throw -1; 00090 00091 empresaBase()->commit(); 00092 _depura("Registro borrado satisfactoriamente", 2); 00093 dialogChanges_cargaInicial(); 00094 close(); 00095 } catch (...) { 00096 _depura("No se pudo borrar el registro de IVA", 2); 00097 empresaBase()->rollback(); 00098 } // end try 00099 } // end if 00100 _depura("END RegistroIva::borraRegistroIva", 0); 00101 return 0; 00102 }
| virtual void RegistroIva::calculaypintatotales | ( | ) | [inline, virtual] |
| virtual void RegistroIva::recalculaIva | ( | ) | [inline, virtual] |
Reimplemented in RegistroIvaView.
Definition at line 205 of file registroiva.h.
References _depura().
Referenced by buscaborradoriva().
00205 {_depura("no implementada", 2);};
| void RegistroIva::vaciaRegistroIva | ( | ) |
Definition at line 108 of file registroiva.cpp.
References _depura(), and DBRecord::DBclear().
00108 { 00109 _depura("RegistroIva::vaciaRegistroIva", 0); 00110 DBclear(); 00111 _depura("END RegistroIva::vaciaRegistroIva", 0); 00112 }
| int RegistroIva::buscaborradorservicio | ( | int | idborrador | ) |
Busca la cuenta del servicio.
| idborrador |
Cogemos de la configuracion las cuentas que queremos que se apunten. Montamos los querys en base a la cadena cuentas.
Vamos a tener en cuenta también las cuentas de IVA.
Atentos que aquí es donde se incorpora el parámetro.
Se calcula el total. El cálculo se compara con el formato conocido de IVA (16, 7, 4: por tanto, formato de 2 dígitos con 0 decimales).
Definition at line 205 of file registroiva.cpp.
References _depura(), postgresiface2::begin(), postgresiface2::cargacursor(), postgresiface2::commit(), cuentas, postgresiface2::ejecuta(), FichaBc::empresaBase(), cursor2::eof(), postgresiface2::rollback(), setbaseimp(), cursor2::siguienteregistro(), and cursor2::valor().
Referenced by inicializa1().
00205 { 00206 _depura("RegistroIva::buscaborradorservicio", 0); 00207 QString SQLQuery; 00208 int registro = 0; 00209 try { 00210 SQLQuery.sprintf("CREATE TEMPORARY TABLE lacosa AS SELECT idborrador, bcontrapartidaborr(idborrador) AS contrapartida , cuenta.idcuenta AS idcuenta, codigo, borrador.debe - borrador.haber AS baseimp FROM borrador, cuenta where borrador.idcuenta=cuenta.idcuenta AND borrador.idasiento IN (SELECT idasiento FROM borrador WHERE idborrador = %d)", idborrador); 00211 empresaBase()->begin(); 00212 int error = empresaBase()->ejecuta(SQLQuery); 00213 SQLQuery.sprintf("DELETE FROM lacosa WHERE idborrador NOT IN (SELECT idborrador FROM lacosa WHERE idborrador = %d UNION SELECT contrapartida AS idborrador FROM lacosa WHERE idborrador = %d) AND contrapartida NOT IN (SELECT idborrador FROM lacosa WHERE idborrador = %d UNION SELECT contrapartida AS idborrador FROM lacosa WHERE idborrador = %d)", idborrador, idborrador, idborrador, idborrador); 00214 error = empresaBase()->ejecuta(SQLQuery); 00215 00216 if (error) { 00217 _depura("Error en la creacion del temporary table", 2); 00218 empresaBase()->rollback(); 00219 return -1; 00220 } // end if 00221 00224 QString cuentas = ""; 00225 SQLQuery = "SELECT valor FROM configuracion WHERE nombre = 'CuentasIngresos'"; 00226 cursor2 *cur = empresaBase()->cargacursor(SQLQuery); 00227 00228 if (!cur->eof()) { 00229 cuentas += cur->valor("valor"); 00230 } // end if 00231 00232 delete cur; 00233 SQLQuery = "SELECT valor FROM configuracion WHERE nombre = 'CuentasGastos'"; 00234 cur = empresaBase()->cargacursor(SQLQuery); 00235 00236 if (!cur->eof()) { 00237 cuentas += ";" + cur->valor("valor"); 00238 } // end if 00239 00240 delete cur; 00241 cuentas.replace(';',"%|^"); 00242 cuentas = "'^" + cuentas + "%'"; 00244 QString cuentasIVA = ""; 00245 SQLQuery = "SELECT valor FROM configuracion WHERE nombre = 'RegistroEmitida'"; 00246 cur=empresaBase()->cargacursor(SQLQuery); 00247 00248 if (!cur->eof()) { 00249 cuentasIVA += cur->valor("valor"); 00250 } // end if 00251 00252 delete cur; 00253 SQLQuery = "SELECT valor FROM configuracion WHERE nombre = 'RegistroSoportada'"; 00254 cur = empresaBase()->cargacursor(SQLQuery); 00255 00256 if (!cur->eof()) { 00257 cuentasIVA += ";" + cur->valor("valor"); 00258 } // end if 00259 00260 delete cur; 00261 cuentasIVA.replace(';', "%|^"); 00262 cuentasIVA = "'^" + cuentasIVA + "%'"; 00264 SQLQuery = "SELECT * FROM lacosa WHERE codigo SIMILAR TO " + cuentas + " OR codigo SIMILAR TO " + cuentasIVA; 00265 cur = empresaBase()->cargacursor(SQLQuery); 00266 00267 while (!cur->eof()) { 00268 fprintf(stderr, "idborrador: %s contrapartida: %s cuenta: %s\n", cur->valor("idborrador").toAscii().constData(), cur->valor("contrapartida").toAscii().constData(), cur->valor("codigo").toAscii().constData()); 00269 registro = atoi(cur->valor("idborrador").toAscii().constData()); 00270 cur->siguienteregistro(); 00271 } //end while 00272 00273 delete cur; 00277 SQLQuery = "SELECT abs(sum(baseimp)) AS subtotal FROM lacosa, (SELECT baseimp AS iva FROM lacosa WHERE codigo SIMILAR TO "+cuentasIVA+") AS iva WHERE codigo SIMILAR TO " + cuentas + " AND (iva.iva*100/baseimp)::NUMERIC(2,0) IN (SELECT porcentajetipoiva FROM tipoiva)"; 00278 cur = empresaBase()->cargacursor(SQLQuery); 00279 00280 if (!cur->eof()) { 00281 setbaseimp(cur->valor("subtotal")); 00282 } // end while 00283 00284 delete cur; 00285 SQLQuery = "DROP TABLE lacosa"; 00286 error = empresaBase()->ejecuta(SQLQuery); 00287 empresaBase()->commit(); 00288 } catch (...) { 00289 _depura("RegistroIva:: Error en transaccion", 2); 00290 empresaBase()->rollback(); 00291 } // end try 00292 _depura("END RegistroIva::buscaborradorservicio", 0); 00293 return registro; 00294 }
| int RegistroIva::buscaborradorcliente | ( | int | idborrador | ) |
Busca la cuenta del cliente o del proveedor en el apunte que se ha seleccionado.
| idborrador |
Cogemos de la configuracion las cuentas que queremos que se apunten. Montamos los querys en base a la cadena cuentas. Se consideran cuentas de Derechos y de Obligaciones a Clientes y Proveedores, respectivamente. Los campos sirven para encontrar la cuenta que corresponde a quien hace el pago de la factura.
Atentos que aquí es donde se incorpora el parámetro.
Ponemos la cuenta de cliente y los valores adyacentes.
Comprobamos si es un cliente o un proveedor y segun sea actuamos en consecuencia.
Definition at line 304 of file registroiva.cpp.
References _depura(), postgresiface2::begin(), postgresiface2::cargacursor(), postgresiface2::commit(), cuentas, postgresiface2::ejecuta(), FichaBc::empresaBase(), cursor2::eof(), postgresiface2::rollback(), setcif(), setcontrapartida(), setfactemitida(), cursor2::siguienteregistro(), and cursor2::valor().
Referenced by inicializa1().
00304 { 00305 _depura("RegistroIva::buscaborradorcliente", 0); 00306 QString SQLQuery; 00307 int registro = 0; 00308 try { 00309 empresaBase()->begin(); 00310 SQLQuery.sprintf("CREATE TEMPORARY TABLE lacosa AS SELECT idborrador, bcontrapartidaborr(idborrador) AS contrapartida , cuenta.cifent_cuenta, cuenta.idcuenta AS idcuenta, codigo, borrador.debe AS debe, borrador.haber AS haber, borrador.debe+borrador.haber AS totalfactura FROM borrador LEFT JOIN cuenta ON borrador.idcuenta=cuenta.idcuenta where borrador.idasiento IN (SELECT idasiento FROM borrador WHERE idborrador = %d)", idborrador); 00311 int error = empresaBase()->ejecuta(SQLQuery); 00312 00313 SQLQuery.sprintf("DELETE FROM lacosa WHERE idborrador NOT IN (SELECT idborrador FROM lacosa WHERE idborrador = %d UNION SELECT contrapartida AS idborrador FROM lacosa WHERE idborrador = %d) AND contrapartida NOT IN (SELECT idborrador FROM lacosa WHERE idborrador = %d UNION SELECT contrapartida AS idborrador FROM lacosa WHERE idborrador = %d)", idborrador, idborrador, idborrador, idborrador); 00314 error = empresaBase()->ejecuta(SQLQuery); 00321 QString cuentas = ""; 00322 SQLQuery = "SELECT valor FROM configuracion WHERE nombre = 'CuentasDerechos'"; 00323 cursor2 *cur1 = empresaBase()->cargacursor(SQLQuery); 00324 if (!cur1->eof()) { 00325 cuentas += cur1->valor("valor"); 00326 } // end if 00327 delete cur1; 00328 SQLQuery = "SELECT valor FROM configuracion WHERE nombre = 'CuentasObligaciones'"; 00329 cur1 = empresaBase()->cargacursor(SQLQuery); 00330 if (!cur1->eof()) { 00331 cuentas += ";" + cur1->valor("valor"); 00332 } // end if 00333 delete cur1; 00334 cuentas.replace(';', "%|^"); 00335 cuentas = "'^" + cuentas + "%'"; 00336 00338 SQLQuery = "SELECT * FROM lacosa WHERE codigo SIMILAR TO " + cuentas; 00339 cursor2 *cur = empresaBase()->cargacursor(SQLQuery); 00340 while (!cur->eof()) { 00342 setcontrapartida(cur->valor("idcuenta")); 00343 setcif(cur->valor("cifent_cuenta")); 00346 if (cur->valor("codigo").left(2) == "43") { 00347 setfactemitida("t"); 00348 } else { 00349 setfactemitida( "f"); 00350 } // end if 00351 registro = cur->valor("idborrador").toInt(); 00352 cur->siguienteregistro(); 00353 } // end while 00354 delete cur; 00355 SQLQuery = "DROP TABLE lacosa"; 00356 error = empresaBase()->ejecuta(SQLQuery); 00357 empresaBase()->commit(); 00358 } catch (...) { 00359 _depura("RegistroIva:: Error en buscaborradorcliente", 2); 00360 empresaBase()->rollback(); 00361 } // end try 00362 _depura("ENd RegistroIva::buscaborradorcliente", 0); 00363 return registro; 00364 }
| int RegistroIva::buscaborradoriva | ( | int | idborrador | ) |
| idborrador |
Cargamos los registros que quedan porque seguro que son de IVA.
Definition at line 426 of file registroiva.cpp.
References _depura(), postgresiface2::begin(), SubForm3::cargar(), postgresiface2::commit(), postgresiface2::ejecuta(), FichaBc::empresaBase(), m_lineas, recalculaIva(), and postgresiface2::rollback().
Referenced by inicializa1().
00426 { 00427 _depura("RegistroIva::buscaborradoriva", 0); 00428 int error = 0; 00429 try { 00430 empresaBase()->begin(); 00431 QString SQLQuery; 00432 SQLQuery.sprintf("CREATE TEMPORARY TABLE lacosa AS SELECT borrador.debe AS ivadebe, borrador.haber AS ivahaber, idborrador, bcontrapartidaborr(idborrador) AS contrapartida , cuenta.idcuenta AS idcuenta, codigo, borrador.fecha AS fecha FROM borrador, cuenta WHERE borrador.idcuenta=cuenta.idcuenta AND borrador.idasiento IN (SELECT idasiento FROM borrador WHERE idborrador = %d)", idborrador); 00433 error = empresaBase()->ejecuta(SQLQuery); 00434 if (error) { 00435 _depura("error en la base de datos", 2); 00436 _depura(SQLQuery, 2); 00437 } // end if 00438 00439 SQLQuery.sprintf("DELETE FROM lacosa WHERE idborrador NOT IN (SELECT idborrador FROM lacosa WHERE idborrador = %d UNION SELECT contrapartida AS idborrador FROM lacosa WHERE idborrador = %d) AND contrapartida NOT IN (SELECT idborrador FROM lacosa WHERE idborrador = %d UNION SELECT contrapartida AS idborrador FROM lacosa WHERE idborrador = %d)", idborrador, idborrador, idborrador, idborrador); 00440 error = empresaBase()->ejecuta(SQLQuery); 00441 00442 if (error) { 00443 _depura("error en la base de datos", 2); 00444 _depura(SQLQuery, 2); 00445 } // end if 00446 00448 SQLQuery = "SELECT *, GREATEST(debe * 100 / porcentajetipoiva, haber * 100 / porcentajetipoiva)::NUMERIC(12, 1) AS baseiva, GREATEST (ivadebe, ivahaber) AS ivaiva FROM tipoiva "; 00449 SQLQuery += " LEFT JOIN (SELECT *, ivadebe AS debe, ivahaber AS haber FROM lacosa) AS lacosa ON tipoiva.idcuenta = lacosa.idcuenta "; 00450 //22/09/07 Ahora se pasa el query 00451 //cursor2 *cur = empresaBase()->cargacursor(SQLQuery); 00452 m_lineas->cargar(SQLQuery); 00453 recalculaIva(); 00454 _depura("limpiamos la base de datos"); 00455 SQLQuery = "DROP TABLE lacosa"; 00456 error = empresaBase()->ejecuta(SQLQuery); 00457 empresaBase()->commit(); 00458 } catch (...) { 00459 _depura("Error al buscar el borrador", 2); 00460 empresaBase()->rollback(); 00461 } // end try 00462 _depura("END RegistroIva::buscaborradoriva", 0); 00463 return 0; 00464 }
| void RegistroIva::inicializa1 | ( | int | idapunte1 | ) |
| idapunte1 |
Busca si a este apunte le corresponde un borrador.
En el caso de que no existiese una cuenta de servicio a la que asociar se Asocia directamente al apunte seleccionado.
Busca entradas de IVA en la tabla registroiva.
El registro ya existe.
El registro no existe y hay que hacer la propuesta más acertada de registro. Buscamos en todo el asiento las cuentas de IVA y lo reflejamos.
Buscamos la fecha que le corresponderá teoricamente a la factura.
Buscamos la cuenta de servicio.
Definition at line 379 of file registroiva.cpp.
References _depura(), buscaborradorcliente(), buscaborradoriva(), buscaborradorservicio(), buscafecha(), buscaNumFactura(), postgresiface2::cargacursor(), cargar(), FichaBc::empresaBase(), cursor2::eof(), idborrador(), pintaRegistroIva(), setidborrador(), and cursor2::valor().
Referenced by Asiento1_guardaAsiento1_post(), RegIVAQToolButton::click(), ListLinAsiento1View_boton_iva(), ListRegistroIvaView::on_mui_tablarepercutido_trataMenu(), and ListRegistroIvaView::on_mui_tablasoportado_trataMenu().
00379 { 00380 _depura("RegistroIva::inicializa1", 0); 00381 QString query, cadena; 00382 int idborrador; 00384 idborrador = buscaborradorcliente(idapunte1); 00387 if (idborrador <= 0) 00388 idborrador = idapunte1; 00390 query.sprintf ( "SELECT * FROM registroiva WHERE idborrador = %d", idborrador); 00391 cursor2 *cursoriva = empresaBase()->cargacursor(query); 00392 if (!cursoriva->eof()) { 00394 cargar( cursoriva->valor("idregistroiva")); 00395 } else { 00398 buscaborradoriva(idapunte1); 00400 buscafecha(idapunte1); 00402 buscaborradorservicio(idapunte1); 00403 buscaNumFactura(idapunte1); 00404 setidborrador(QString::number(idapunte1)); 00405 } // end if 00406 delete cursoriva; 00407 pintaRegistroIva(); 00408 _depura("END RegistroIva::inicializa1", 0); 00409 }
| void RegistroIva::buscafecha | ( | int | idborrador | ) |
SLOT que se dispara cuando se ha hecho el botón de búsqueda de una fecha.
| idborrador |
Definition at line 471 of file registroiva.cpp.
References _depura(), postgresiface2::cargacursor(), FichaBc::empresaBase(), cursor2::eof(), setfemisionregistroiva(), setffactura(), and cursor2::valor().
Referenced by inicializa1().
00471 { 00472 _depura("RegistroIva::buscafecha", 0); 00473 QString SQLQuery; 00474 cursor2 *cur = empresaBase()->cargacursor("SELECT fecha from borrador WHERE idborrador = " + QString::number(idborrador)); 00475 if (!cur->eof()) { 00476 setffactura(cur->valor("fecha").left(10)); 00477 setfemisionregistroiva(cur->valor("fecha").left(10)); 00478 } // end if 00479 delete cur; 00480 _depura("END RegistroIva::buscafecha", 0); 00481 }
| void RegistroIva::buscaNumFactura | ( | int | idborrador | ) |
| idborrador |
La factura no existe, entonces proponemos el siguiente número de factura. Vemos si podemos extraer de la descripción del apunte el número de factura.
Si se cumple el patrón
Si no saco el nº de fra. lo pongo a cero, por poner algo.
Si se cumple el patrón
Si no saco el nº de fra. lo pongo a cero, por poner algo.
Buscamos qué número de orden poner.
Fin proposición números factura y orden.
Definition at line 492 of file registroiva.cpp.
References _depura(), postgresiface2::cargacursor(), FichaBc::empresaBase(), cursor2::eof(), setfactura(), setnumorden(), setserieregistroiva(), and cursor2::valor().
Referenced by inicializa1().
00492 { 00493 _depura("RegistroIva::buscaNumFactura", 0); 00494 QString query; 00495 cursor2 *recordset; 00496 QString cadena; 00497 int numord; 00498 query.sprintf("SELECT factura, numorden FROM registroiva WHERE idborrador IN (SELECT idborrador FROM borrador WHERE idasiento=(SELECT idasiento FROM borrador WHERE idborrador = '%i'))", idborrador); 00499 recordset = empresaBase()->cargacursor(query); 00500 if (!recordset->eof()) { 00501 setfactura( recordset->valor("factura")); 00502 setnumorden( recordset->valor("numorden")); 00503 } else { 00507 query.sprintf("SELECT * FROM borrador WHERE idasiento IN (SELECT idasiento FROM borrador WHERE idborrador = '%i') AND debe = 0", idborrador); 00508 recordset = empresaBase()->cargacursor(query, "recordset"); 00509 00510 QString num_ser = recordset->valor("conceptocontable"); 00511 QRegExp patrons(" ([A-Z]*)[0-9]+$"); 00512 if (patrons.indexIn(num_ser) > -1) { 00513 num_ser = patrons.cap(1); 00514 } else { 00515 num_ser = "Normal"; 00516 } // end if 00517 setserieregistroiva(num_ser); 00518 00519 QString num_fra = recordset->valor("conceptocontable"); 00520 QRegExp patron(" [A-Z]*([0-9]+)$"); 00521 if (patron.indexIn(num_fra) > -1) { 00522 num_fra = patron.cap(1); 00523 } else { 00524 num_fra = "0"; 00525 } // end if 00526 setfactura(num_fra); 00528 query.sprintf("SELECT MAX(to_number(numorden,'99999')) AS numorden FROM registroiva WHERE numorden <> ''"); 00529 recordset = empresaBase()->cargacursor(query, "recordset"); 00530 if (!recordset->eof()) { 00531 numord = 1 + atoi(recordset->valor("numorden").toAscii().constData()); 00532 } else { 00533 numord = 1; 00534 } // end if 00535 setnumorden(QString::number(numord)); 00536 } // end if 00537 delete recordset; 00538 _depura("END RegistroIva::buscaNumFactura", 0); 00539 }
SubForm2Bc* RegistroIva::m_lineas [protected] |
1.5.1