SubForm2Bt Class Reference

Clase SubForm2Bt. More...

#include <subform2bt.h>

Inheritance diagram for SubForm2Bt:

SubForm3 BLWidget Ui_SubForm3Base QWidget PEmpresaBase

Public Slots

virtual void on_mui_list_pressedSlash (int row, int col)
virtual void on_mui_list_pressedAsterisk (int row, int col)
virtual void on_mui_list_pressedMinus (int row, int col)

Public Member Functions

 SubForm2Bt (QWidget *parent=0)
virtual ~SubForm2Bt ()
virtual void cargar (QString query)
virtual void setEmpresaBase (EmpresaBase *)
virtual void on_mui_list_cellChanged (int row, int col)
virtual int cerrarEditor ()
void setIdCliente (QString id)
void setIdProveedor (QString id)

Data Fields

QSubForm2BtDelegatem_delegate

Protected Attributes

QString mdb_idcliente
QString mdb_idproveedor

Detailed Description

Clase SubForm2Bt.

Es la primera abstraccion de los subformularios que incluye todas las características comunes de la facturación.

Definition at line 59 of file subform2bt.h.


Constructor & Destructor Documentation

SubForm2Bt::SubForm2Bt ( QWidget parent = 0  ) 

Parameters:
parent 

Definition at line 39 of file subform2bt.cpp.

References _depura(), m_delegate, mdb_idcliente, Ui_SubForm3Base::mui_list, SubForm3::setDelete(), and TRUE.

00039                                       : SubForm3(parent) {
00040     _depura("SubForm2Bt::SubForm2Bt", 0);
00041     setDelete(TRUE);
00042     m_delegate = new QSubForm2BtDelegate(this);
00043     mui_list->setItemDelegate(m_delegate);
00044     mdb_idcliente = "";
00045     _depura("END SubForm2Bt::SubForm2Bt", 0);
00046 }

SubForm2Bt::~SubForm2Bt (  )  [virtual]

Definition at line 52 of file subform2bt.cpp.

References _depura(), and m_delegate.

00052                         {
00053     _depura("SubForm2Bt::~SubForm2Bt", 0);
00054     delete m_delegate;
00055     _depura("END SubForm2Bt::~SubForm2Bt", 0);
00056 }


Member Function Documentation

void SubForm2Bt::cargar ( QString  query  )  [virtual]

Parameters:
query 

Reimplemented from SubForm3.

Definition at line 63 of file subform2bt.cpp.

References _depura(), and SubForm3::cargar().

Referenced by myplugin::inicializa().

00063                                      {
00064     _depura("SubForm2Bt::cargar", 0);
00065     SubForm3::cargar(query);
00066     _depura("END SubForm2Bt::cargar", 0);
00067 }

void SubForm2Bt::setEmpresaBase ( EmpresaBase c  )  [virtual]

Parameters:
c 

Reimplemented from SubForm3.

Definition at line 234 of file subform2bt.cpp.

References _depura(), m_delegate, PEmpresaBase::setEmpresaBase(), and SubForm3::setEmpresaBase().

Referenced by myplugin::inicializa().

00234                                               {
00235     _depura("SubForm2Bt::setcompany", 0);
00236     SubForm3::setEmpresaBase(c);
00237     m_delegate->setEmpresaBase(c);
00238     _depura("END SubForm2Bt::setcompany", 0);
00239 }

void SubForm2Bt::on_mui_list_cellChanged ( int  row,
int  col 
) [virtual]

Parameters:
row 
col 
Returns:

Reimplemented from SubForm3.

Definition at line 113 of file subform2bt.cpp.

References _depura().

00113                                                          {
00114     _depura("SubForm2Bt::on_mui_list_cellChanged", 0, QString::number(row) + " " + QString::number(col));
00115     _depura("END SubForm2Bt::on_mui_list_editFinished", 0);
00116 }

int SubForm2Bt::cerrarEditor (  )  [virtual]

Returns:

Reimplemented from SubForm3.

Definition at line 246 of file subform2bt.cpp.

References _depura(), QSubForm2BtDelegate::cerrarEditor(), m_delegate, and Ui_SubForm3Base::mui_list.

00246                              {
00247     _depura("SubForm2Bt::cerrarEditor", 0);
00248     QWidget *editor = mui_list->QAbstractItemView::indexWidget(mui_list->currentIndex());
00249     m_delegate->cerrarEditor(editor);
00250     _depura("END SubForm2Bt::cerrarEditor", 0);
00251     return 0;
00252 }

void SubForm2Bt::setIdCliente ( QString  id  ) 

Parameters:
id 
Returns:

En la primera carga no hay reajustes, pero si actualización del cliente.

En las cargas sucesivas si el idcliente no ha cambiado no se hace nada

Reseteamos los valores.

Si el idcliente no existe salimos.

Cuando se cambia el cliente se deben recalcular las lineas por si hay Recargo Equivalente

Definition at line 124 of file subform2bt.cpp.

References _depura(), postgresiface2::cargacursor(), PEmpresaBase::empresaBase(), cursor2::eof(), SubForm3::lineaat(), SubForm3::m_tablename, mdb_idcliente, SubForm3::rowCount(), DBRecord::setDBvalue(), and cursor2::valor().

00124                                         {
00125     _depura("SubForm2Bt::setIdCliente", 0, id);
00126 
00128     if (mdb_idcliente  == "" ) {
00129     mdb_idcliente = id;
00130     return;
00131     } // end if
00132 
00134     if (mdb_idcliente == id) return;
00135 
00137     for (int i = 0; i < rowCount() - 1; i++) {
00138         SDBRecord *rec = lineaat(i);
00139         rec->setDBvalue("iva" + m_tablename, "0");
00140         rec->setDBvalue("reqeq" + m_tablename, "0");
00141     } // end for
00142 
00143     mdb_idcliente = id;
00144 
00146     if (id == "") {
00147         _depura("END SubForm2Bt::setIdCliente", 0, "idcliente invalido");
00148         return;
00149     } // end if
00150 
00151     cursor2 *curcliente = empresaBase()->cargacursor("SELECT recargoeqcliente, regimenfiscalcliente FROM cliente WHERE idcliente = " + mdb_idcliente);
00152 
00153     if (!curcliente->eof()) {
00155         for (int i = 0; i < rowCount() - 1; i++) {
00156             SDBRecord *rec = lineaat(i);
00157             cursor2 *cur = empresaBase()->cargacursor("SELECT * FROM articulo WHERE idarticulo = " + rec->DBvalue("idarticulo") );
00158             cursor2 *cur1 = empresaBase()->cargacursor("SELECT * FROM tasa_iva WHERE idtipo_iva = " + cur->valor("idtipo_iva") + " ORDER BY fechatasa_iva LIMIT 1");
00159             if (!cur->eof()) {
00160 
00161                 if (curcliente->valor("regimenfiscalcliente") == "Normal") {
00162                     rec->setDBvalue("iva" + m_tablename, cur1->valor("porcentasa_iva"));
00163                 } // end if
00164 
00165                 if (curcliente->valor("recargoeqcliente") == "t") {
00166                     rec->setDBvalue("reqeq" + m_tablename, cur1->valor("porcentretasa_iva"));
00167                 } // end if
00168 
00169             } // end if
00170             delete cur1;
00171             delete cur;
00172         } // end for
00173     } // end if
00174     delete curcliente;
00175     _depura("END SubForm2Bt::setIdCliente", 0);
00176 }

void SubForm2Bt::setIdProveedor ( QString  id  ) 

Parameters:
id 
Returns:

En la primera carga no hay reajustes, pero si actualización del proveedor.

En las cargas sucesivas si el idproveedor no ha cambiado no se hace nada

Reseteamos los valores

Cuando se cambia el cliente se deben recalcular las lineas por si hay Recargo Equivalente

Definition at line 184 of file subform2bt.cpp.

References _depura(), postgresiface2::cargacursor(), PEmpresaBase::empresaBase(), cursor2::eof(), SubForm3::lineaat(), SubForm3::m_tablename, mdb_idproveedor, SubForm3::rowCount(), DBRecord::setDBvalue(), and cursor2::valor().

00184                                           {
00185     _depura("SubForm2Bt::setIdProveedor", 0, id);
00186 
00188     if (mdb_idproveedor  == "" ) {
00189         mdb_idproveedor = id;
00190         return;
00191     } // end if
00192 
00194     if (mdb_idproveedor == id) return;
00195 
00196     mdb_idproveedor = id;
00197 
00199     for (int i = 0; i < rowCount() - 1; i++) {
00200         SDBRecord *rec = lineaat(i);
00201         rec->setDBvalue("iva"+m_tablename, "0");
00202         rec->setDBvalue("reqeq"+m_tablename, "0");
00203     } // end for
00204 
00205     cursor2 *curproveedor = empresaBase()->cargacursor("SELECT recargoeqproveedor, regimenfiscalproveedor FROM proveedor WHERE idproveedor="+mdb_idproveedor);
00206     if (!curproveedor->eof()) {
00208         for (int i = 0; i < rowCount() - 1; i++) {
00209             SDBRecord *rec = lineaat(i);
00210             cursor2 *cur = empresaBase()->cargacursor("SELECT * FROM articulo WHERE idarticulo = " + rec->DBvalue("idarticulo") );
00211             cursor2 *cur1 = empresaBase()->cargacursor("SELECT * FROM tasa_iva WHERE idtipo_iva = " + cur->valor("idtipo_iva") + " ORDER BY fechatasa_iva LIMIT 1");
00212             if (!cur->eof() ) {
00213                 if (curproveedor->valor("regimenfiscalproveedor") == "Normal") {
00214                     rec->setDBvalue("iva"+m_tablename, cur1->valor("porcentasa_iva"));
00215                 } // end if
00216                 if (curproveedor->valor("recargoeqproveedor") == "t") {
00217                     rec->setDBvalue("reqeq"+m_tablename, cur1->valor("porcentretasa_iva"));
00218                 } // end if
00219 
00220             } // end if
00221             delete cur1;
00222             delete cur;
00223         } // end for
00224     } // end if
00225     delete curproveedor;
00226     _depura("END SubForm2Bt::setIdProveedor", 0);
00227 }

void SubForm2Bt::on_mui_list_pressedSlash ( int  row,
int  col 
) [virtual, slot]

Parameters:
row 
col 

Reimplemented from SubForm3.

Definition at line 87 of file subform2bt.cpp.

References _depura(), editaTexto(), SubForm3::item(), and SDBCampo::set().

00087                                                           {
00088     _depura("SubForm2Bt::pressedSlash", 0);
00089     SDBCampo *camp = (SDBCampo *) item(row, col);
00090     QString text = editaTexto(camp->text());
00091     camp->set(text);
00092     _depura("END SubForm2Bt::pressedSlash", 0);
00093 }

void SubForm2Bt::on_mui_list_pressedAsterisk ( int  row,
int  col 
) [virtual, slot]

Parameters:
row 
col 
Returns:

Reimplemented from SubForm3.

Definition at line 76 of file subform2bt.cpp.

References _depura().

00076                                                              {
00077     _depura("SubForm2Bt::pressedAsterisk", 0);
00078     _depura("END SubForm2Bt::pressedAsterisk", 0);
00079 }

void SubForm2Bt::on_mui_list_pressedMinus ( int  row,
int  col 
) [virtual, slot]

Parameters:
row 
col 

Reimplemented from SubForm3.

Definition at line 101 of file subform2bt.cpp.

References _depura().

00101                                                           {
00102     _depura("SubForm2Bt::pressedMinus", 0);
00103     _depura("END SubForm2Bt::pressedMinus", 0);
00104 }


Field Documentation

QSubForm2BtDelegate* SubForm2Bt::m_delegate

Definition at line 63 of file subform2bt.h.

Referenced by cerrarEditor(), setEmpresaBase(), SubForm2Bt(), and ~SubForm2Bt().

QString SubForm2Bt::mdb_idcliente [protected]

Definition at line 66 of file subform2bt.h.

Referenced by setIdCliente(), and SubForm2Bt().

QString SubForm2Bt::mdb_idproveedor [protected]

Definition at line 67 of file subform2bt.h.

Referenced by setIdProveedor().


The documentation for this class was generated from the following files:
Generated on Sat Dec 15 00:02:16 2007 for BulmaGes by  doxygen 1.5.1