public function PaymentConfirm()
 {
     //create the model object
     $cal = new PaymentConfirm();
     $cal->printColumlistAsAttributes();
     //send the webclass
     $webClass = __CLASS__;
     //run the crud utility
     Crud::run($cal, $webClass);
     //pr($mps);
 }
 function addConfirm()
 {
     $err = array();
     $json['bool'] = 0;
     //       $json['err'] = array("apptitle"=>"harus diisi");
     $ttdate = addslashes($_POST['ttdate']);
     if ($ttdate == "") {
         $err['ttdate'] = "Date must be filled";
     }
     $ttname = addslashes($_POST['ttname']);
     if ($ttname == "") {
         $err['ttname'] = "Name must be filled";
     }
     $ttamount = addslashes($_POST['ttamount']);
     if ($ttamount == "") {
         $err['ttamount'] = "Amount must be filled";
     }
     $ttto = addslashes($_POST['ttto']);
     if ($ttto == "") {
         $err['ttto'] = "Bank Account must be filled";
     }
     if (count($err) > 0) {
         $json['bool'] = 0;
         $json['err'] = $err;
     } else {
         //save here
         $pc = new PaymentConfirm();
         $pc->confirm_app_id = addslashes($_POST['appid']);
         $pc->confirm_bank = $ttto;
         $pc->confirm_amount = $ttamount;
         $pc->confirm_create_date = leap_mysqldate();
         $pc->confirm_date = $ttdate;
         $pc->confirm_name = $ttname;
         $pc->confirm_receipt = addslashes($_POST['ttfile']);
         $pc->confirm_status = "not reviewed";
         $pc->confirm_user_id = Account::getMyID();
         $confirmID = $pc->save();
         if ($confirmID) {
             $app = new AppAccount();
             $app->getByID($pc->confirm_app_id);
             $app->app_active = 2;
             $app->load = 1;
             $app->app_pulsa = 1000;
             $app->save();
             $paket = new Paket();
             $paket->getByID($app->app_paket_id);
             //add pporder
             $ppo = new PaypalOrder();
             $ppo->payment_id = $confirmID;
             $ppo->payment_type = "banktt";
             $ppo->amount = $pc->confirm_amount;
             $ppo->currency = "IDR";
             $ppo->created_time = leap_mysqldate();
             $ppo->state = "pending";
             $ppo->user_id = Account::getMyID();
             $ppo->description = "Payment " . $app->app_name . " Paket " . $paket->paket_name . " ID : " . $app->app_id;
             $succ = $ppo->save();
             if ($succ) {
                 $json['bool'] = 1;
                 $json['order_id'] = $succ;
             } else {
                 $json['bool'] = 0;
                 $json['all'] = "Saving PPO Error";
             }
         } else {
             $json['bool'] = 0;
             $json['all'] = "Saving PConfirm Error";
         }
     }
     echo json_encode($json);
     die;
 }