Esempio n. 1
0
 function save($empno, $date, $tenders, $checks, $notes)
 {
     global $FANNIE_PLUGIN_SETTINGS;
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
     $model = new DailyNotesModel($dbc);
     $model->date($date);
     $model->emp_no($empno);
     $notes = str_replace("'", "''", urldecode($notes));
     $model->note($notes);
     $model->save();
     $model = new DailyChecksModel($dbc);
     $model->date($date);
     $model->emp_no($empno);
     $model->checks($checks);
     $model->save();
     $model = new DailyCountsModel($dbc);
     $model->date($date);
     $model->emp_no($empno);
     $tarray = explode("|", $tenders);
     foreach ($tarray as $t) {
         $temp = explode(":", $t);
         if (count($temp) != 2) {
             continue;
         }
         if (!is_numeric($temp[1])) {
             continue;
         }
         $tender = $temp[0];
         $amt = $temp[1];
         $model->tender_type($tender);
         $model->amt($amt);
         $model->save();
     }
     return "Saved";
 }
Esempio n. 2
0
 function save($date, $data)
 {
     global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
     $bycashier = explode(',', $data);
     $model = new DailyCountsModel($dbc);
     $model->date($date);
     foreach ($bycashier as $c) {
         $temp = explode(':', $c);
         if (count($temp) != 2) {
             continue;
         }
         $cashier = $temp[0];
         $tenders = explode(';', $temp[1]);
         $model->emp_no($cashier);
         foreach ($tenders as $t) {
             $temp = explode('|', $t);
             $tender_type = $temp[0];
             $amt = isset($temp[1]) ? rtrim($temp[1]) : '';
             if ($amt != '') {
                 $model->tender_type($tender_type);
                 $model->amt($amt);
                 $model->save();
             }
         }
     }
 }