/** * makes a stock ledger entry * * @param int $stkid stock id * @param char $type [c/d] whether contra should be debited/credited * @param int $contra contra account * @param string $date date of transaction * @param int $refno transaction reference number * @param float $amount transaction amount * @param char $vat [y/n] vat yes/no * @param string $details details of transaction * @return boolean true on success */ function makeStockLedger($stkid, $type, $contra, $date, $refno, $amount, $vat, $details) { global $complete; if ($type == "c") { $debitacc = null; $creditacc = $contra; } else { $debitacc = $contra; $creditacc = null; } $this->cols = array("iid" => $stkid, "debitacc" => $debitacc, "creditacc" => $creditacc, "date" => $date, "refno" => $refno, "amount" => $amount, "details" => $details); if (!is_null($debitacc) && !clsIncludes::incExist("accounts", $debitacc)) { clsIncludes::add_account($debitacc); } if (!is_null($creditacc) && !clsIncludes::incExist("accounts", $creditacc)) { clsIncludes::add_account($creditacc); } if (!isset($complete["STOCK"][$stkid])) { $complete["STOCK"][$stkid] = new clsInfoObj("STOCK", $stkid); return $complete["STOCK"][$stkid]->dbMake("SELECT * FROM cubit.stock WHERE stkid='{$stkid}'"); } return true; }
function startElement($parser, $name, $pattrs) { global $stack, $stack_counter, $stack_ptr, $complete, $inc_active; if ($name == "TRANSACTIONDATA") { return; } $newobj = false; switch ($name) { case "DEBTOR": case "CREDITOR": case "STOCK": $newobj = new clsInfoObj($name, $pattrs["ID"]); break; case "JOURNAL": $newobj = new clsLedger($pattrs["TYPE"]); break; case "INCLUDES": $inc_active = $pattrs["TYPE"]; break; case "INCDEF": clsIncludes::addXML($inc_active, $pattrs); break; default: if ($stack_ptr !== false) { $stack_ptr->xmlStartElement($parser, $name, $pattrs); } } if ($newobj !== false) { ++$stack_counter; $stack[$stack_counter] = $stack_ptr = $newobj; } }