Exemple #1
0
function handle_cancel_po()
{
    global $path_to_root;
    //need to check that not already dispatched or invoiced by the supplier
    if ($_SESSION['PO']->order_no != 0 && $_SESSION['PO']->any_already_received() == 1) {
        display_error(tr("This order cannot be cancelled because some of it has already been received.") . "<br>" . tr("The line item quantities may be modified to quantities more than already received. prices cannot be altered for lines that have already been received and quantities cannot be reduced below the quantity already received."));
        return;
    }
    if ($_SESSION['PO']->order_no != 0) {
        delete_po($_SESSION['PO']->order_no);
    }
    $_SESSION['PO']->clear_items();
    $_SESSION['PO'] = new purch_order();
    display_note(tr("This purchase order has been cancelled."), 0, 1);
    hyperlink_params($path_to_root . "/purchasing/po_entry_items.php", tr("Enter a new purchase order"), "NewOrder=Yes");
    echo "<br>";
    end_page();
    exit;
}
Exemple #2
0
         //after get po data, check the poState_no is = 1, is mean 開啟 -- 等待到貨, with can delete it directly
         case 1:
             //save the data to db and delete the record
             $serialize_po = '';
             $serialize_po = $po->get_serialize_po();
             if (!empty($serialize_po)) {
                 $insert_obj = new stdClass();
                 $insert_obj->receipttype = 'po';
                 $insert_obj->receiptno = $po_data->po_no;
                 $insert_obj->staffno = $_SESSION['staff_no'];
                 $insert_obj->date = time();
                 $insert_obj->staffid = $_SESSION['staff_id'];
                 $insert_obj->data = $po->get_serialize_po();
                 $delete_log_no = $db->insert_record('delete_log', $insert_obj);
                 if ($delete_log_no) {
                     delete_po($po_data);
                     //print out deleted po msg
                     $msgarray = array();
                     $msgarray["msg"] = "PO {$po_data->po_no} has been delete";
                     $msgarray["ok"] = 1;
                     echo tojson($msgarray);
                 }
             }
             break;
         default:
             print_error('[x][po003]PO cannot delete, PO num : ' . $po_data->po_no . ', PO state num : ' . $po_data->postate_no);
             break;
     }
     break;
 case 'viewdeleedpo':
     break;