Exemplo n.º 1
0
             $o->getInputForm("new", -1, $token);
         }
     } 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_ACG");
         $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y');
         $o->periodctrl = $simbizctrl->getSelectPeriod($o->accounts_id, 'N');
         $o->periodctrl = $simbizctrl->getSelectPeriod($o->period_id);
         $o->accountsctrl = $simbizctrl->getSelectAccounts($o->accounts_id, 'Y', "onchange='refreshAccounts(this.value)'", "accounts_id", 'and account_type=4');
         $o->getInputForm("new", -1, $token);
     }
     break;
     //when user request to edit particular organization
 //when user request to edit particular organization
 case "edit":
     if ($o->fetchBankReconcilation($o->bankreconcilation_id)) {
         //create a new token for editing a form
         $token = $s->createToken($tokenlife, "CREATE_ACG");
         $o->periodctrl = $simbizctrl->getSelectPeriod($o->accounts_id, 'N');
         $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y');
         $o->accountsctrl = $simbizctrl->getSelectAccounts($o->accounts_id, 'Y', "onchange='refreshAccounts(this.value)'", "accounts_id", 'and account_type=4', 'Y');
         $o->transctrl = $o->genChildList($o->accounts_id, $o->bankreconcilation_id, $o->iscomplete);
         $o->periodctrl = $simbizctrl->getSelectPeriod($o->period_id);
         //$o->transactiontable=$trans->showTransTable($o->bankreconcilation_id,$o->iscomplete);
         $o->getInputForm("edit", $o->bankreconcilation, $token);
     } else {
         //if can't find particular organization from database, return error message
         redirect_header("bankreconcilation.php", 3, "Some error on viewing your bankreconcilation data, probably database corrupted");
     }
     break;
     //when user press save for change existing organization data
        $this->Cell(0, 5, 'Page ' . $this->PageNo() . '/{nb} Generated dated ' . $timestamp, 0, 0, 'C');
    }
}
if (isset($_GET["submit"])) {
    include_once "system.php";
    include_once "../simantz/class/Period.inc.php";
    include_once "class/Accounts.php";
    include_once "class/BankReconcilation.php";
    $period = new Period();
    $pdf = new PDF('P', 'mm', 'A4');
    $acc = new Accounts();
    $pdf->AliasNbPages();
    $pdf->SetAutoPageBreak(true, $pdf->pagefooterheight + 1);
    $currentbankreconcilation_id = $_GET['bankreconcilation_id'];
    $r = new BankReconcilation();
    $r->fetchBankReconcilation($currentbankreconcilation_id);
    $accounts_id = $r->accounts_id;
    $period_id = $r->period_id;
    //$periodfrom_id=1;
    //$periodto_id=2;
    //getdatefrom
    $period->fetchPeriod($period_id);
    if (strlen($period->period_month) == 1) {
        $period->period_month = '0' . $period->period_month;
    }
    $datefrom = "{$period->period_year}-{$period->period_month}-01";
    //getdateto
    $dateto = "{$period->period_year}-{$period->period_month}-31";
    $pdf->datefrom = $datefrom;
    $pdf->dateto = $dateto;
    $acc->fetchAccounts($accounts_id);