#include "plugintotal.h"#include "funcaux.h"#include "empresatpv.h"#include "total.h"#include "plugins.h"#include "ticket.h"#include "qapplication2.h"Go to the source code of this file.
Typedefs | |
| typedef QMap< QString, Fixed > | base |
Functions | |
| int | entryPoint (BulmaTPV *tpv) |
| int | EmpresaTPV_createMainWindows_Post (EmpresaTPV *etpv) |
| int | Ticket_pintar (Ticket *tick) |
Variables | |
| Total * | g_tot |
| QDockWidget * | g_doc1 |
Una factura puede tener multiples bases imponibles. Por eso definimos el tipo base como un QMap.
Definition at line 34 of file plugintotal.cpp.
| int EmpresaTPV_createMainWindows_Post | ( | EmpresaTPV * | etpv | ) |
| int entryPoint | ( | BulmaTPV * | tpv | ) |
Vamos a probar con un docwindow.
Definition at line 43 of file plugintotal.cpp.
References _depura(), and g_doc1.
00043 { 00044 _depura("entryPoint", 0); 00045 00047 g_doc1 = new QDockWidget("Total", tpv); 00048 g_doc1->setFeatures(QDockWidget::AllDockWidgetFeatures); 00049 00050 g_doc1->setGeometry(100, 100, 100, 500); 00051 g_doc1->resize(330, 400); 00052 tpv->addDockWidget(Qt::LeftDockWidgetArea, g_doc1); 00053 g_doc1->show(); 00054 00055 _depura("END entryPoint", 0); 00056 return 0; 00057 }
| int Ticket_pintar | ( | Ticket * | tick | ) |
Definition at line 68 of file plugintotal.cpp.
References postgresiface2::cargacursor(), DBRecord::DBvalue(), PEmpresaBase::empresaBase(), cursor2::eof(), g_bud, g_tot, Ticket::listaLineas(), MTicket::pintar(), Fixed::toQString(), cursor2::valor(), and Fixed::value.
00068 { 00069 00070 base basesimp; 00071 base basesimpreqeq; 00072 DBRecord *linea; 00073 00074 EmpresaTPV *emp = (EmpresaTPV *)tick->empresaBase(); 00075 00077 QString l; 00078 Fixed irpf("0"); 00079 00080 cursor2 *cur = emp->cargacursor("SELECT * FROM configuracion WHERE nombre = 'IRPF'"); 00081 if (cur) { 00082 if (!cur->eof()) { 00083 irpf = Fixed(cur->valor("valor")); 00084 } // end if 00085 delete cur; 00086 } // end if 00087 00088 00089 Fixed descuentolinea("0.00"); 00090 for (int i = 0; i < tick->listaLineas()->size(); ++i) { 00091 linea = tick->listaLineas()->at(i); 00092 Fixed cant(linea->DBvalue("cantlalbaran")); 00093 Fixed pvpund(linea->DBvalue("pvplalbaran")); 00094 Fixed desc1(linea->DBvalue("descuentolalbaran")); 00095 Fixed cantpvp = cant * pvpund; 00096 Fixed base = cantpvp - cantpvp * desc1 / 100; 00097 descuentolinea = descuentolinea + (cantpvp * desc1 / 100); 00098 basesimp[linea->DBvalue("ivalalbaran")] = basesimp[linea->DBvalue("ivalalbaran")] + base; 00099 basesimpreqeq[linea->DBvalue("reqeqlalbaran")] = basesimpreqeq[linea->DBvalue("reqeqlalbaran")] + base; 00100 } // end for 00101 00102 Fixed basei("0.00"); 00103 base::Iterator it; 00104 for (it = basesimp.begin(); it != basesimp.end(); ++it) { 00105 basei = basei + it.value(); 00106 } // end for 00107 00110 Fixed porcentt("0.00"); 00111 /* 00112 SDBRecord *linea1; 00113 if (m_listadescuentos->rowCount()) { 00114 for (int i = 0; i < m_listadescuentos->rowCount(); ++i) { 00115 linea1 = m_listadescuentos->lineaat(i); 00116 Fixed propor(linea1->DBvalue("proporcion" + m_listadescuentos->tableName()).toAscii().constData()); 00117 porcentt = porcentt + propor; 00118 } // end for 00119 } // end if 00120 */ 00121 00123 Fixed totbaseimp("0.00"); 00124 Fixed parbaseimp("0.00"); 00125 for (it = basesimp.begin(); it != basesimp.end(); ++it) { 00126 if (porcentt > Fixed("0.00")) { 00127 parbaseimp = it.value() - it.value() * porcentt / 100; 00128 } else { 00129 parbaseimp = it.value(); 00130 } // end if 00131 totbaseimp = totbaseimp + parbaseimp; 00132 } // end for 00133 00135 Fixed totiva("0.00"); 00136 Fixed pariva("0.00"); 00137 for (it = basesimp.begin(); it != basesimp.end(); ++it) { 00138 Fixed piva(it.key().toAscii().constData()); 00139 if (porcentt > Fixed("0.00")) { 00140 pariva = (it.value() - it.value() * porcentt / 100) * piva / 100; 00141 } else { 00142 pariva = it.value() * piva / 100; 00143 } // end if 00144 totiva = totiva + pariva; 00145 } // end for 00146 00148 Fixed totreqeq("0.00"); 00149 Fixed parreqeq("0.00"); 00150 for (it = basesimpreqeq.begin(); it != basesimpreqeq.end(); ++it) { 00151 Fixed preqeq(it.key().toAscii().constData()); 00152 if (porcentt > Fixed("0.00")) { 00153 parreqeq = (it.value() - it.value() * porcentt / 100) * preqeq / 100; 00154 } else { 00155 parreqeq = it.value() * preqeq / 100; 00156 } // end if 00157 totreqeq = totreqeq + parreqeq; 00158 } // end for 00159 00160 00161 00162 Fixed totirpf = totbaseimp * irpf / 100; 00163 00164 Fixed total = totiva + totbaseimp + totreqeq - totirpf; 00165 00166 00168 g_tot->mui_display->display(total.toQString()); 00169 }
Definition at line 38 of file plugintotal.cpp.
Definition at line 37 of file plugintotal.cpp.
1.5.1