public function viewInputForm() { // $grid = $this->getGrid($this->quotation_id); $this->address_text = str_replace("\n", "<br/>", $this->address_text); $this->address_text = str_replace(" ", " ", $this->address_text); $this->description = str_replace("\n", "<br/>", $this->description); $this->description = str_replace(" ", " ", $this->description); // $balanceamt = $this->getOutstandingAmt($this->quotation_id); // $paymenthistory = $this->getPaymentHistory($this->quotation_id); if ($this->batch_id > 0) { $viewjournalctrl = " <a href='batch.php?action=view&batch_id={$this->batch_id}' target='_blank'>View Journal</a><br/>"; } $tableheader = "Quotation"; include "../bpartner/class/BPartner.php"; $bp = new BPartner(); $creditstatusarr = $bp->checkCreditLimit($this->bpartner_id, $this->organization_id, $this->issotrx); $consumecredit = $creditstatusarr["usage"]; $creditlimit = $creditstatusarr["limitamt"]; $credittext = "{$creditlimit}/{$consumecredit}"; if ($this->iscomplete == 1) { $documentstatus = "This transaction is completed!"; $iscompletectrl = "<input type='button' name='save' onclick='reactivateQuotation()' value='Re-activate'/>"; } else { $documentstatus = "This transaction is voided, it doesn't effect account"; $iscompletectrl = ""; } $startdate = date("Y-m-", time()) . "01"; $enddate = date("Y-m-d", time()); $this->note = str_replace("\n", "<br/>", $this->note); $this->address_text = str_replace("\n", "<br/>", $this->address_text); $this->description = str_replace("\n", "<br/>", $this->description); $viewsubtable = $this->viewsubtable(); $this->defineHeaderButton(); $html = <<<HTML <script> function reactivateQuotation(){ \t\tif(confirm("Reactivate this record? The transaction from journal will reverse automatically.")){ var quotation_id=document.getElementById("quotation_id").value; var data="action=reactivate"ation_id="+quotation_id; \$.ajax({ url: "{$this->quotationfilename}",type: "POST",data: data,cache: false, \t\t\t\t\t\t\tsuccess: function (xml) { if(xml != ""){ jsonObj = eval( '(' + xml + ')'); if(jsonObj.status==1){ window.location="{$this->quotationfilename}?action=edit"ation_id={$this->quotation_id}"; } else alert("Cannot reactivate quotation! Msg: "+jsonObj.msg); } } }); \t\t} } function previewQuotation(){ \t window.open("{$this->quotationfilename}?action=pdf"ation_id="+document.getElementById("quotation_id").value) } \t\tfunction viewlinehistory(il_id){ \t\t\t//tablename=sim_country&idname=country_id&title=Country \t\t\twindow.open("../simantz/recordinfo.php?tablename=sim_bpartner_quotationline&idname=quotationline_id&title={$menuname}&id="+il_id); \t\t\t} \t\tfunction viewhistory(){ \t\t\t \t\t\twindow.open("../simantz/recordinfo.php?tablename=sim_bpartner_quotation&idname=quotation_id&title={$menuname}&id={$this->quotation_id}"); \t\t\t} \tfunction duplicateQuotation(){ \t var quotation_id=document.getElementById("quotation_id").value; // popup('popUpDiv'); var data="action=duplicate"ation_id="+quotation_id; \$.ajax({ url: "{$this->quotationfilename}",type: "POST",data: data,cache: false, success: function (xml) { if(xml != "") // jsonObj = eval( '(' + xml + ')'); document.getElementById('idApprovalWindows').innerHTML = xml; document.getElementById('idApprovalWindows').style.display = ""; // popup('popUpDiv'); } }); \t\t} \t\t function closeWindow(){ document.getElementById('idApprovalWindows').style.display = "none"; document.getElementById('idApprovalWindows').innerHTML = ""; } </script> <br/> <div id="idApprovalWindows" style="display:none"></div> <div id='blanket' style='display:none;'></div> <div class="searchformblock" style="float:right;">\t </div> \t\t <div id='centercontainer'> <div align="center" > <table style="width:990px;text-align: left; " > <tr><td align="left">{$this->addnewctrl}</td><td align="right">{$this->searchctrl}</td></tr></table> {$noperm} <b style='color:red;'>{$documentstatus}</b> <br/> <div id='errormsg' class='red' style='display:none'></div> <div> <form onsubmit='return false' method='post' name='frmQuotation' id='frmQuotation' action='{$this->quotationfilename}' enctype="multipart/form-data"> <table style="text-align: left; width: 990px;" border="0" cellpadding="0" cellspacing="1" class="searchformblock"> <tbody> <tr> <td colspan="5" rowspan="1" align="center" id="idHeaderText" class="searchformheader" >{$tableheader}</td> </tr> <tr> <td class="head">Quotation No</td> <td class="even">{$this->spquotation_prefix} {$this->document_no} Branch: {$this->organization_code}</td> <td class="head">Business Partner</td> <td class="even"> <a href="../bpartner/bpartner.php?action=viewsummary&bpartner_id={$this->bpartner_id}" target="_blank">{$this->bpartner_name}</a> </td> <td rowspan='6'></td> </tr> <tr> <td class="head">Date (YYYY-MM-DD)</td> <td class="even">{$this->document_date} <td class="head">Attn To </td> <td class="even">{$this->contacts_name}</td> </tr> <tr> <td class="head">Terms</td> <td class="even">{$this->terms_name}</td> <td class="head">{$refno}</td> <td class="even">{$this->ref_no}</td> </tr> <tr> <td class="head">Prepared By</td> <td class="even">{$this->preparedbyname}</td> <td class="head">Sales Agent</td> <td class="even">{$this->saleagent_name}</td> </tr> <tr> <td class="head">Address</td> <td class="even">{$this->address_text} </td> <td class="head">Currency</td> <td class="even">{$this->currency_code} (Exchange Rate: {$this->exchangerate})</td> <tr><td colspan='5'> <div id='detaildiv'> {$viewsubtable} </div> </td></tr> <tr><td colspan='5' style='text-align:right'> <input type='button' value='Preview' onclick='javascript:previewQuotation()'/> <input name='quotation_id' id='quotation_id' value='{$this->quotation_id}' title='quotation_id' type='hidden'> <input name='iscomplete' id='iscomplete' value='{$this->iscomplete}' title='iscomplete' type='hidden'> {$iscompletectrl} <input type="button" value="Duplicate" onclick=duplicateQuotation()> \t <input type='button' id='btnviewhistory' name='btnviewhistory' onclick='viewhistory()' value='View Record Info'/> \t</td> <tr> <td class="head">Description</td> <td class="even" colspan='5' style="width:70%">{$this->description}</td> </tr> </tr> <td class="head">Note</td> <td class="even" colspan='3'>{$this->note}</td> </tr></table> </form> </div> </div> HTML; return $html; }
include "../bpartner/class/BPSelectCtrl.inc.php"; $bpctrl = new BPSelectCtrl(); include "../bpartner/class/BPartner.php"; $bp = new BPartner(); $bpartner_id = $_REQUEST['bpartner_id']; $bp->fetchBpartnerData($bpartner_id); $addressxml = str_replace(">", "}}}", str_replace("<", "{{{", $bpctrl->getSelectAddress(0, "N", $bpartner_id))); $termsxml = str_replace(">", "}}}", str_replace("<", "{{{", $bpctrl->getSelectTerms($bp->terms_id, "N"))); $contactxml = str_replace(">", "}}}", str_replace("<", "{{{", $bpctrl->getSelectContacts(0, 'N', "", "", " and bpartner_id={$bpartner_id}"))); $currencyxml = str_replace(">", "}}}", str_replace("<", "{{{", $ctrl->getSelectCurrency($bp->currency_id))); if ($o->issotrx == 1) { $acc_id = $bp->debtoraccounts_id; } else { $acc_id = $bp->creditoraccounts_id; } $arrcredit = $bp->checkCreditLimit($bpartner_id, $defaultorganization_id, $o->issotrx); $control = $arrcredit["control"]; $limitamt = $arrcredit["limitamt"]; $usage = $arrcredit["usage"]; echo "<result><address>{$addressxml}</address><terms>{$termsxml}</terms><contact>{$contactxml}</contact>" . "<currency>{$currencyxml}</currency><bpartneraccounts_id>{$acc_id}</bpartneraccounts_id><status>1</status>" . "<limitamt>{$limitamt}</limitamt><usage>{$usage}</usage><control>{$control}</control></result>"; die; break; case "search": include "menu.php"; $xoTheme->addStylesheet("{$url}/modules/simantz/include/jqueryui/themes/base/jquery.ui.all.css"); $xoTheme->addScript("{$url}/modules/simantz/include/jqueryui/ui/jquery.ui.core.js"); $xoTheme->addScript("{$url}/modules/simantz/include/jqueryui/ui/jquery.ui.widget.js"); $xoTheme->addScript("{$url}/modules/simantz/include/jqueryui/ui/jquery.ui.button.js"); $xoTheme->addScript("{$url}/modules/simantz/include/jqueryui/ui/jquery.ui.datepicker.js"); $xoTheme->addScript("{$url}/modules/simantz/include/jqueryui/ui/jquery.ui.autocomplete.js"); $xoTheme->addScript("{$url}/modules/simantz/include/jqueryui/ui/jquery.ui.position.js");