/** The setInterest method. This method returns the $interest associated with the payment. ** @public ** @returns identifier to the interest **/ function storeRecord() { //if isStoredInDatabase then use an update statement if ($this->isStoredInDatabase) { $this->updateRecord(); } else { // else use an insert statement if ($this->application == "") { return false; } //create a DB object $rptsDB = new DB_RPTS(); //prepare SQL statement $sqlinsert = "INSERT INTO payments\r\n SET amount = {$this->amount},\r\n application = '{$this->application}',\r\n dueType = '{$this->dueType}',\r\n dueID = {$this->dueID},\r\n receiptNum = '{$this->receiptNum}'"; $queryID = $rptsDB->query($sqlinsert); if ($queryID) { $this->paymentID = $rptsDB->insert_id(); $this->isStoredInDatabase = true; return true; } else { return false; } } }
function insertRPTOPRecord($rptop) { if (is_array($rptop)) { $db = new DB_RPTS(); $sql = sprintf("INSERT INTO %s(" . "rptopNumber" . ", rptopDate" . ", taxableYear" . ", cityTreasurer" . ", cityAssessor" . ", landTotalMarketValue" . ", landTotalAssessedValue" . ", plantTotalMarketValue" . ", plantTotalAssessedValue" . ", bldgTotalMarketValue" . ", bldgTotalAssessedValue" . ", machTotalMarketValue" . ", machTotalAssessedValue" . ", totalMarketValue" . ", totalAssessedValue" . ", dateCreated" . ", createdBy" . ", dateModified" . ", modifiedBy" . ") VALUES(" . "'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s'" . ",'%s','%s','%s','%s','%s','%s','%s','%s','%s');", RPTOP_TABLE, fixQuotes($rptop["rptopNumber"]), fixQuotes(date("Y-m-d"), strtotime("now")), fixQuotes($rptop["taxableYear"]), fixQuotes($rptop["cityTreasurer"]), fixQuotes($rptop["cityAssessor"]), fixQuotes($rptop["landTotalMarketValue"]), fixQuotes($rptop["landTotalAssessedValue"]), fixQuotes($rptop["plantTotalMarketValue"]), fixQuotes($rptop["plantTotalAssessedValue"]), fixQuotes($rptop["bldgTotalMarketValue"]), fixQuotes($rptop["bldgTotalAssessedValue"]), fixQuotes($rptop["machTotalMarketValue"]), fixQuotes($rptop["machTotalAssessedValue"]), fixQuotes($rptop["totalMarketValue"]), fixQuotes($rptop["totalAssessedValue"]), fixQuotes(time()), fixQuotes($rptop["createdBy"]), fixQuotes(time()), fixQuotes($rptop["modifiedBy"])); $db->beginTransaction(); $db->query($sql); $rptopID = $db->insert_id(); if ($db->Errno != 0) { $db->rollbackTransaction(); $db->resetErrors(); return false; } else { $db->endTransaction(); return $rptopID; } } else { return false; } }
function store() { //if isStoredInDatabase then use an update statement if ($this->isStoredInDatabase) { return $this->update(); } else { // else use an insert statement //create a DB object $rptsDB = new DB_RPTS(); //prepare SQL statement $strUpDate = date("Y-m-d H:i:s", time()); // changed from $this->updateDate $strDueDate = date("Y-m-d", $this->getDueDate()); $sqlinsert = "INSERT INTO dues\r\n SET basic = '{$this->basic}',\r\n penalty = '{$this->penalty}',\r\n sef = '{$this->sef}',\r\n idle = '{$this->idle}',\t\t\t\t\t\t\t \r\n tdID = '{$this->tdID}',\r\n dueDate = '{$strDueDate}',\r\n currentDate = '{$strUpDate}', \r\n\t\t\t\t\t\t\t paidBasic = '{$this->paidBasic}',\r\n paidSEF = '{$this->paidSEF}',\r\n paidPenalty = '{$this->paidPenalty}',\r\n\t\t\t\t\t\t\t paidIdle = '{$this->paidIdle}',\r\n paidQuarters = '{$this->paidQuarters}',\r\n paymentMode = '{$this->paymentMode}'"; // query the database $queryID = $rptsDB->query($sqlinsert); if ($queryID) { $this->dueID = $rptsDB->insert_id(); $this->isStoredInDatabase = true; return true; } else { return false; } } }
/** The method. This method stores the object into the database ** @public ** @returns void **/ function storeRecord() { //create a DB object $rptsDB = new DB_RPTS(); //if isStoredInDatabase then update if ($this->isStoredInDatabase) { if ($this->updateRecord()) { return true; } else { return false; } } else { // else use an insert statement // prepare SQL statement $sqlinsert = sprintf("insert into %s (" . "collectionDate" . ", collectionSum" . ", receiptNum" . ", receivedFrom" . ", kindOfPayment" . ", checkNum" . ", checkDate" . ", oldReceiptNum" . ", oldReceiptDate" . ", municipality" . ", amnesty" . ")" . " values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s');", collections, fixQuotes($this->collectionDate), fixQuotes($this->collectionSum), fixQuotes($this->receiptNum), fixQuotes($this->receivedFrom), fixQuotes($this->kindOfPayment), fixQuotes($this->checkNum), fixQuotes($this->checkDate), fixQuotes($this->oldReceiptNum), fixQuotes($this->oldReceiptDate), fixQuotes($this->municipality), fixQuotes($this->amnesty)); $queryID = $rptsDB->query($sqlinsert); if ($queryID) { $this->collectionID = $rptsDB->insert_id(); // store the payments if ($this->storeByReceipt($this->collectionID)) { $this->isStoredInDatabase = true; return true; } else { return false; } } else { return false; } } }