string MVBuilding::toString() const { stringstream s; s << getName() << " (" << getColorString() << ", " << getPrice() << "):"; return s.str(); }
void print() const { std::cout << "Rabbit price: " << getPrice(); }
void Product::print() const { cout << "UPC: " << getUPC() << endl; cout << "Name: " << getName() << endl; cout << "Price: " << getPrice() << endl; }
void print() const { std::cout << "PolarBear price: " << getPrice(); }
void print() const { std::cout << "Squirrel price: " << getPrice(); }
PriceValue CryptocoinChartsMDP::getBtcPrice(const QString &ticker, bool force_refresh) { if(ticker == "") return PriceValue(0.0, PriceValue::OK); if(ticker == "BTC") return PriceValue(1.0, PriceValue::OK); QString trading_pair = ticker.toLower() + "_btc"; return getPrice(trading_pair, force_refresh); }
double CryptocoinChartsMDP::getBtcUsdRate() { return getPrice("btc_usd").value; }
float InvoiceLine::getAmount() const { return (qte * getPrice()) - qte * getPrice() * off / 100.0; }
double Swap::getPrice(double timeToMaturity, double k){ return getPrice(timeToMaturity, 1, k); }
bool Contract::hasValidPrice() { return getPrice().isValid(); }
float Dvd::getTotalCost() { return (float)(getPrice()*1.18) + 1; }
void PurchaseEditor::addItemToList() { ProductInfo pInfo; Azahar *myDb = new Azahar; myDb->setDatabase(db); bool ok=false; if (ui->editCode->text().isEmpty()) ui->editCode->setFocus(); else if (ui->editDesc->text().isEmpty()) ui->editDesc->setFocus(); else if (ui->editPoints->text().isEmpty()) ui->editPoints->setFocus(); else if (ui->editCost->text().isEmpty()) ui->editCost->setFocus(); else if (ui->editTax->text().isEmpty()) ui->editTax->setFocus(); else if (ui->editFinalPrice->text().isEmpty()) ui->editFinalPrice->setFocus(); else if (ui->editQty->text().isEmpty() || ui->editQty->text()=="0") ui->editQty->setFocus(); else if ((ui->editUtility->text().isEmpty() && ui->editFinalPrice->text().isEmpty()) || ui->editFinalPrice->text().toDouble()<=ui->editCost->text().toDouble() ) ui->editFinalPrice->setFocus(); else if (ui->groupBoxedItem->isChecked() && (ui->editItemsPerBox->text().isEmpty() || ui->editItemsPerBox->text()=="0")) ui->editItemsPerBox->setFocus(); else if (ui->groupBoxedItem->isChecked() && (ui->editPricePerBox->text().isEmpty() || ui->editPricePerBox->text()=="0")) ui->editPricePerBox->setFocus(); else ok = true; if (ok) { ProductInfo info = myDb->getProductInfo(QString::number(getCode())); if (info.code == 0) { info.code = getCode(); info.lastProviderId=1; //for now.. fixme in the future } //update p.info from the dialog info.desc = getDescription(); info.price = getPrice(); info.cost = getCost(); info.tax = getTax1(); //FIXME: add tax models //info.extratax= getTax2(); info.photo = getPhotoBA(); info.units = getMeasureId(); info.category= getCategoryId(); info.profit = getProfit(); info.points = getPoints(); info.stockqty= getQtyOnDb(); info.purchaseQty = getPurchaseQty(); double finalCount = info.purchaseQty + info.stockqty; // WHAT FOR?? info.validDiscount = productExists; //used to check if product is already on db. //FIXME: NEXT 2 lines are temporal remove on 0.8 version //info.alphaCode = "-NA-"; //FIXME: last providerId for an existent must be gotten from db since we dont have that field here. Provide a combobox to select one and a button to add a new one. //info.lastProviderId = 1; if (info.isAGroup) { // get each product fo the group/pack QStringList list = gelem.split(","); for (int i=0; i<list.count(); ++i) { QStringList tmp = list.at(i).split("/"); if (tmp.count() == 2) { //ok 2 fields qulonglong code = tmp.at(0).toULongLong(); pInfo = myDb->getProductInfo(QString::number(code)); pInfo.purchaseQty = getPurchaseQty(); pInfo.validDiscount = true; // all grouped products exists insertProduct(pInfo); ///inserting each product of the group } // correct fields }//for each element } else insertProduct(info); resetEdits(); ui->editCode->setFocus(); } }
double DiscountSale::bill( ) const { double fraction = discount/100; return (1 - fraction)*getPrice( ); }
void shop() { // Displays the shop interface // Waits for a number to be inputted, and dispatches to buy() char c; // Clear the screen printf(clearScreen); // Prompt printf("Welcome to the shop! Choose what upgrade you would like to purchase.\n"); printf("You have %d doves to spend.\n\n", doves); // Display avaliable upgrades if (netLevel < MAX_LEVEL) { printf(" 1: Upgrade Net - %d doves - %d doves per <ENTER>\n", getPrice(netLevel+1), netBonusDoves[netLevel+1]); printf(" %s\n\n", netDescriptions[netLevel]); } else { printf(" 1: Net Fully Upgraded!\n\n"); } if (dealerLevel < MAX_LEVEL) { printf(" 2: Upgrade Dealer - %d doves - %d dove discount on upgrades\n", getPrice(dealerLevel+1), dealerDiscounts[dealerLevel+1]); printf(" %s\n\n", dealerDescriptions[dealerLevel]); } else { printf(" 2: Dealer Fully Upgraded!\n\n"); } if (baitLevel < MAX_LEVEL) { printf(" 3: Upgrade Bait - %d doves - %d doves per 10 <ENTER>s\n", getPrice(baitLevel+1), baitBonusDoves[baitLevel+1]); printf(" %s\n\n", baitDescriptions[baitLevel]); } else { printf(" 3: Bait Fully Upgraded!\n\n"); } if (breedingLevel < MAX_LEVEL) { printf(" 4: Upgrade Breeding - %d doves - %d new doves/10 doves every 100 <ENTER>s\n", getPrice(breedingLevel +1), breedingInterest[breedingLevel+1]); printf(" %s\n\n", breedingDescriptions[breedingLevel]); } else { printf(" 4: Breeding Fully Upgraded!\n\n"); } // Upgrade selection prompt printf("Type <ENTER> to exit the store\n"); printf("> "); // Listen for a character c = getFirstCharOfLine(); // Buy something if (c == '1') buy(&netLevel); // Buy net else if (c == '2') buy(&dealerLevel); // Buy dealer else if (c == '3') buy(&baitLevel); // Buy bait else if (c == '4') buy(&breedingLevel); // Buy breeding }