void voucher::populate() { XSqlQuery vohead; vohead.prepare( "SELECT vohead_number, vohead_pohead_id, vohead_terms_id," " vohead_distdate, vohead_docdate, vohead_duedate," " vohead_invcnumber, vohead_reference," " vohead_1099, vohead_amount, vohead_curr_id " "FROM vohead " "WHERE (vohead_id=:vohead_id);" ); vohead.bindValue(":vohead_id", _voheadid); vohead.exec(); if (vohead.first()) { _voucherNumber->setText(vohead.value("vohead_number").toString()); _poNumber->setId(vohead.value("vohead_pohead_id").toInt()); _terms->setId(vohead.value("vohead_terms_id").toInt()); _amountToDistribute->set(vohead.value("vohead_amount").toDouble(), vohead.value("vohead_curr_id").toInt(), vohead.value("vohead_docdate").toDate(), false); _distributionDate->setDate(vohead.value("vohead_distdate").toDate(), true); _invoiceDate->setDate(vohead.value("vohead_docdate").toDate()); _dueDate->setDate(vohead.value("vohead_duedate").toDate()); _invoiceNum->setText(vohead.value("vohead_invcnumber").toString()); _reference->setText(vohead.value("vohead_reference").toString()); _flagFor1099->setChecked(vohead.value("vohead_1099").toBool()); sFillList(); sFillMiscList(); sPopulateDistributed(); } }
void voucher::sDeleteMiscDistribution() { q.prepare( "DELETE FROM vodist " "WHERE (vodist_id=:vodist_id);" ); q.bindValue(":vodist_id", _miscDistrib->id()); q.exec(); sFillMiscList(); sPopulateDistributed(); }
void voucher::sEditMiscDistribution() { ParameterList params; params.append("mode", "edit"); params.append("vodist_id", _miscDistrib->id()); params.append("curr_id", _amountToDistribute->id()); params.append("curr_effective", _amountToDistribute->effective()); voucherMiscDistrib newdlg(this, "", TRUE); newdlg.set(params); if (newdlg.exec() != XDialog::Rejected) { sFillMiscList(); sPopulateDistributed(); } }
void voucher::sDeleteMiscDistribution() { saveDetail(); q.prepare( "DELETE FROM voheadtax " "WHERE (taxhist_parent_id=:vohead_id) " " AND (taxhist_taxtype_id=getadjustmenttaxtypeid()) " " AND (taxhist_tax_id = (SELECT vodist_tax_id FROM vodist WHERE (vodist_id=:vodist_id))); " "DELETE FROM vodist " "WHERE (vodist_id=:vodist_id);"); q.bindValue(":vohead_id", _voheadid); q.bindValue(":vodist_id", _miscDistrib->id()); q.exec(); sFillMiscList(); sPopulateDistributed(); }
void voucher::sNewMiscDistribution() { ParameterList params; params.append("mode", "new"); params.append("vohead_id", _voheadid); params.append("curr_id", _amountToDistribute->id()); params.append("curr_effective", _amountToDistribute->effective()); params.append("amount", _balance->localValue()); voucherMiscDistrib newdlg(this, "", TRUE); newdlg.set(params); if (newdlg.exec() != XDialog::Rejected) { sFillMiscList(); sPopulateDistributed(); } }
void voucher::populate() { XSqlQuery vohead; vohead.prepare( "SELECT vohead_number, vohead_pohead_id, vohead_taxzone_id, vohead_terms_id," " vohead_distdate, vohead_docdate, vohead_duedate," " vohead_invcnumber, vohead_reference," " vohead_1099, vohead_amount, vohead_curr_id, vohead_notes " "FROM vohead " "WHERE (vohead_id=:vohead_id);" ); vohead.bindValue(":vohead_id", _voheadid); vohead.exec(); if (vohead.first()) { _voucherNumber->setText(vohead.value("vohead_number").toString()); _poNumber->setId(vohead.value("vohead_pohead_id").toInt(), "PO"); _taxzone->setId(vohead.value("vohead_taxzone_id").toInt()); _terms->setId(vohead.value("vohead_terms_id").toInt()); _amountToDistribute->set(vohead.value("vohead_amount").toDouble(), vohead.value("vohead_curr_id").toInt(), vohead.value("vohead_docdate").toDate(), false); _distributionDate->setDate(vohead.value("vohead_distdate").toDate(), true); _invoiceDate->setDate(vohead.value("vohead_docdate").toDate()); _dueDate->setDate(vohead.value("vohead_duedate").toDate()); _invoiceNum->setText(vohead.value("vohead_invcnumber").toString()); _reference->setText(vohead.value("vohead_reference").toString()); _flagFor1099->setChecked(vohead.value("vohead_1099").toBool()); _notes->setText(vohead.value("vohead_notes").toString()); sFillList(); sFillMiscList(); sPopulateDistributed(); } else if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } }