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"; }
function saveNotes($date, $notes) { global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS; $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']); $noteIDs = explode('`', $notes); $model = new DailyNotesModel($dbc); $model->date($date); foreach ($noteIDs as $n) { $temp = explode('|', $n); $emp = $temp[0]; $note = str_replace("'", "''", urldecode($temp[1])); $model->emp_no($emp); $model->note($note); $model->save(); } }