$production->setReceiver($_POST['receiver']); $production->setReceiverDate($_POST['receiver_date']); } $production->store(); } catch (fExpectedException $e) { echo $e->printMessage(); } } else { if ($_POST['type'] == "cancel") { try { $production = new Production_issue($_POST['key']); $production->setStatus("cancelled"); $production->store(); } catch (fExpectedException $e) { echo $e->printMessage(); } } else { if ($_POST['type'] == "count") { //$records = Production_issue::findAll(); $records = Production_issue::findByBranch(fRequest::get('branch', 'string'), fRequest::get('doctype', 'string')); echo sprintf("%03d", $records->count() + 1); } else { if ($_POST['type'] == "deleteDetail") { Production_issue_detail::deleteDetail($_POST['key']); } } } } } } }