} $o->countryctrl = $ctrl->getSelectCountry($o->country_id, 'N'); $o->currencyctrl = $ctrl->getSelectCurrency($o->currency_id, 'N'); $o->getInputForm("new", -1, $token); $o->showOrganizationTable("where organization_id>0", "order by defaultlevel,organization_name"); } break; //when user request to edit particular organization //when user request to edit particular organization case "edit": if ($o->fetchOrganization($o->organization_id)) { $token = $s->createToken($tokenlife, "CREATE_ORG"); $o->countryctrl = $ctrl->getSelectCountry($o->country_id, 'N'); $o->currencyctrl = $ctrl->getSelectCurrency($o->currency_id, 'N'); $o->groupctrl = $ctrl->getAllSystemGroup($o->groupid); $o->accruedaccctrl = $ctrl->getSelectAccounts($o->accrued_acc, 'Y', "", "accrued_acc", "", "", "N", "", "", "style='width:150px'"); $o->socsoaccctrl = $ctrl->getSelectAccounts($o->socso_acc, 'Y', "", "socso_acc", "", "", "N", "", "", "style='width:150px'"); $o->epfaccctrl = $ctrl->getSelectAccounts($o->epf_acc, 'Y', "", "epf_acc", "", "", "N", "", "", "style='width:150px'"); $o->salaryaccctrl = $ctrl->getSelectAccounts($o->salary_acc, 'Y', "", "salary_acc", "", "", "N", "", "", "style='width:150px'"); $o->getInputForm("edit", $o->organization_id, $token); $o->showOrganizationTable("where organization_id>0", "order by defaultlevel,organization_name"); } else { //if can't find particular organization from database, return error message redirect_header("organization.php", 3, "Some error on viewing your organization data, probably database corrupted"); } break; //when user press save for change existing organization data //when user press save for change existing organization data case "update": if ($s->check(false, $token, "CREATE_ORG")) { $o->updatedby = $xoopsUser->getVar('uid');
} // $pdf->MultiCell(175,7,$isselectline,1,'C'); } //display pdf $pdf->Output(); exit(1); } else { include_once "menu.php"; include_once 'class/Log.php'; include_once 'class/SelectCtrl.php'; include_once "../../class/datepicker/class.datepicker.php"; $dp = new datepicker("{$tableprefix}"); $dp->dateFormat = 'Y-m-d'; error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); $ctrl = new SelectCtrl(); $accountsctrl = $ctrl->getSelectAccounts(0, 'N'); $periodfrom = $ctrl->getSelectPeriod(0, 'Y', "", "period_from"); $periodto = $ctrl->getSelectPeriod(0, 'Y', "", "period_to"); $showDateFrom = $dp->show("datefrom"); $showDateTo = $dp->show("dateto"); $datefrom = getMonth(date("Ymd", time()), 0); $dateto = getMonth(date("Ymd", time()), 1); echo <<<EOF <table border='1'> <tbody> <tr><TH colspan='4' style='text-align: center'>Criterial</TH></tr> \t<FORM name='frmIncome' method='POST' atarget="_blank" action="viewincome.php"> \t<tr> \t\t<Td class='head'>Account From</Td> \t\t<Td class='odd'><input name='accounts_codefrom' value="{$accounts_codefrom}"></Td> \t\t<Td class='head'>Account To</Td>
// $acc->recalculateAllParentAccounts(); } */ redirect_header("bpartner.php?action=view&bpartner_id={$o->bpartner_id}", $pausetime, "Your data is saved, Create More Record."); //redirect_header("bpartner.php?action=edit&bpartner_id=$latest_id",$pausetime,"Your data is saved, the new id=$latest_id"); } else { $token = $s->createToken($tokenlife, "CREATE_BPARTNER"); $log->saveLog(0, $tablebpartner, $o->updatesql, "I", "F"); $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y'); $o->bpartnergroupctrl = $ctrl->getSelectBPartnerGroup($o->bpartnergroup_id, 'Y', "onchange='getDefaultAccount(this.value)'"); $o->industryctrl = $ctrl->getSelectIndustry($o->industry_id, 'N'); $o->currencyctrl = $ctrl->getSelectCurrency($o->currency_id, 'N'); $o->termsctrl = $ctrl->getSelectTerms($o->terms_id, 'Y'); $o->taxctrl = $ctrl->getSelectTax($o->tax_id, 'Y'); if ($accountmoduleexist == true) { $o->debtoraccountsctrl = $ctrl->getSelectAccounts($o->debtoraccounts_id, 'Y', "onchange=''", "debtoraccounts_id", ""); $o->creditoraccountsctrl = $ctrl->getSelectAccounts($o->creditoraccounts_id, 'Y', "onchange=''", "creditoraccounts_id", ""); } else { $o->debtoraccountsctrl = "Accounting Module doesn't exist <input type='hidden' name='debtoraccounts_id' value=0>"; $o->creditoraccountsctrl = "Accounting Module doesn't exist <input type='hidden' name='creditoraccounts_id' value=0>"; } // $o->accountsctrl=$ctrl->getSelectAccounts($o->accounts_id,'Y',"onchange=''","accounts_id",""); $o->getInputForm("new", -1, $token); $o->showBPartnerTable("WHERE bpartner_id>0 and organization_id={$defaultorganization_id}", "ORDER BY defaultlevel,bp.bpartner_no,bpartner_name"); } } else { // if the token is not valid or the token is expired, it back to previous form with previous inputed data $token = $s->createToken($tokenlife, "CREATE_BPARTNER"); $log->saveLog(0, $tablebpartner, $o->updatesql, "I", "F"); $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y'); $o->bpartnergroupctrl = $ctrl->getSelectBPartnerGroup($o->bpartnergroup_id, 'Y', "onchange='getDefaultAccount(this.value)'");
//$pdf->MultiCell(0,5,$sql,0,'C'); $pdf->BasicTable($data); //display pdf //$pdf->Output("doc.pdf","D"); $pdf->Output("Accounts.pdf", "I"); exit(1); } else { include_once "menu.php"; include_once 'class/Log.php'; include_once 'class/SelectCtrl.php'; include_once "../../class/datepicker/class.datepicker.php"; $dp = new datepicker("{$tableprefix}"); $dp->dateFormat = 'Y-m-d'; error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); $ctrl = new SelectCtrl(); $accountsctrlfrom = $ctrl->getSelectAccounts(0, 'Y', "", "accounts_codefrom"); $accountsctrlto = $ctrl->getSelectAccounts(0, 'Y', "", "accounts_codeto"); $periodctrl = $ctrl->getSelectPeriod(0, 'Y'); $showDateFrom = $dp->show("datefrom"); $showDateTo = $dp->show("dateto"); $datefrom = getMonth(date("Ymd", time()), 0); $dateto = getMonth(date("Ymd", time()), 1); echo <<<EOF <table border='1'> <tbody> <tr><TH colspan='4' style='text-align: center'>Criterial</TH></tr> \t<FORM name='frmTrialBalance' method='POST' target="_blank" > \t<tr> \t\t<!-- \t\t<Td class='head'>Account From</Td> \t\t<Td class='odd'><input name='accounts_codefrom1' value="{$accounts_codefrom}"></Td>
$o->isactive = 0; } switch ($action) { //When user submit new organization case "create": // if the token is exist and not yet expired $log->showLog(4, "Accessing create record event, with bpartnergroup name={$o->bpartnergroup_name}"); if ($s->check(false, $token, "CREATE_ACG")) { if ($o->insertBPartnerGroup()) { $latest_id = $o->getLatestBPartnerGroupID(); redirect_header("bpartnergroup.php", $pausetime, "Your data is saved, redirect to create more business partner group."); } else { $log->showLog(1, "Business partner group '{$o->bpartnergroup_name}' cannot save, please check your data."); $token = $s->createToken($tokenlife, "CREATE_ACG"); $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y'); $o->debtoraccountsctrl = $ctrl->getSelectAccounts($o->debtoraccounts_id, 'Y', "", "debtoraccounts_id", "AND placeholder=0 AND account_type =2"); $o->creditoraccountsctrl = $ctrl->getSelectAccounts($o->creditoraccounts_id, 'Y', "", "creditoraccounts_id", "AND placeholder=0 AND account_type =3"); $o->getInputForm("new", -1, $token); $o->showBPartnerGroupTable("WHERE g.bpartnergroup_id>0 and g.organization_id={$defaultorganization_id}", "ORDER BY g.defaultlevel,g.bpartnergroup_name"); } } else { // if the token is not valid or the token is expired, it back to previous form with previous inputed data $log->showLog(1, "Business partner group '{$o->bpartnergroup_name}' cannot be save due to token expired."); $token = $s->createToken($tokenlife, "CREATE_ACG"); $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y'); $o->debtoraccountsctrl = $ctrl->getSelectAccounts($o->debtoraccounts_id, 'Y', "", "debtoraccounts_id", "AND placeholder=0 AND account_type =2"); $o->creditoraccountsctrl = $ctrl->getSelectAccounts($o->creditoraccounts_id, 'Y', "", "creditoraccounts_id", "AND placeholder=0 AND account_type =3"); $o->getInputForm("new", -1, $token); $o->showBPartnerGroupTable("WHERE g.bpartnergroup_id>0 and g.organization_id={$defaultorganization_id}", "ORDER BY g.defaultlevel,g.bpartnergroup_name"); } break;