bool Bill::remove(int id) { bool remove = bd.exec("delete from bill where idbill = " + QString::number(id)); if (remove){ refreshModel(); emitCountBills(); getTotalValue(); } return remove; }
numeric_t SplitComponent::setAmount(const numeric_t & amount) { doSetAmount(amount); m_pricePerUnit = getAmount() / getInputsUnitsTotal(); //notify that our cells were 'recomputed' ICell* pCell = NULL; foreach(pCell, m_cells) pCell->notify(); const numeric_t & myAmount = getAmount(); Q_ASSERT(compareNumeric(getTotalValue(this), myAmount)); //cells sum should match return myAmount; }
bool Bill::insert() { QList<QString> values; values << QString::number(bd.generateID("bill", "idbill")); values << name << QString::number(value) << type << status; values << tools.convertDate(dateExpiration) << tools.convertDate(datePayment) << note; bool insert = bd.insert("bill", values); if (insert){ emitCountBills(); refreshModel(); getTotalValue(); } return insert; }
bool Bill::update(int id) { QList<QString> fields; QList<QString> values; values << name << QString::number(value) << type << status; values << tools.convertDate(dateExpiration) << tools.convertDate(datePayment) << note; fields << "name" << "valuebill" << "typebill" << "status" << "dateexpiration" << "datepayment" << "note"; bool update = bd.update("bill", fields, values, "idbill", QString::number(id)); if (update){ refreshModel(); getTotalValue(); } return update; }
variant_t Column::getSummary() const { return getTotalValue(nullptr); }