Exemple #1
0
function RemoveJobFromParcel()
{
    $table = SelectRelTable();
    $sql = "DELETE FROM {$table} WHERE mmb_parcel090foke_job_idb = '" . $_REQUEST['id'] . "' AND mmb_parcele16e_parcel_ida = '" . $_REQUEST['pid'] . "'";
    UpdateDatabase($sql, 'Job removed from Parcel');
}
Exemple #2
0
    $content .= '</div></div></div>';
}
if ($cmd == '[JOB_CARD]') {
    $content .= '<div class="container">';
    $field = array('photo2');
    $sql = "SELECT * from {$tbn} where id ='{$id}'";
    $content .= DisplayRecord('job_images', $sql, $field);
    $field = array('name', 'weight', 'repair_type', 'additional_instructions', 'estimate', 'finger_size', 'wax_cad_est_req', 'loose_stones', 'stone_information', 'items_to_return', 'due_back_date', 'max_price');
    $sql = "SELECT * from {$tbn} where id ='{$id}'";
    $content .= DisplayRecord('job_card', $sql, $field);
    $content .= '<button onclick="printFunction()" id="print_button" class="btn btn-default pull-right">Print</button></div>';
}
if ($cmd == '[PARCEL]') {
    $content .= '<div class="container-fluid"><div class="row"><div class="col-md-4">';
    $parcel_tb = SelectTable();
    $parcel_tb_rel = SelectRelTable();
    //Calculate total number of parcels to work out how many pages needed for pagination
    $sql = "SELECT * FROM {$parcel_tb}";
    $result = mysqli_query($con, $sql) or die(mysqli_error() . "Error in " . $sql);
    $row_count = mysqli_num_rows($result);
    $total_pages = ceil($row_count / 25);
    $field = array('name', 'tracking', 'date_sent', 'date_received');
    $sql = "SELECT * FROM {$parcel_tb} ORDER BY date_entered DESC LIMIT {$start_from}, 25";
    $table_name = 'parcel';
    $content .= DisplayTable($sql, $field, $table_name, $row_count);
    $content .= Button('new_parcel', 'New Parcel', 'btn-default') . Paginate($total_pages) . '</div>';
    if ($pid != '') {
        $content .= '<div class="col-md-4">';
        $sql = "SELECT * from {$parcel_tb_rel} JOIN mmb_bespoke_job ON {$parcel_tb_rel}.mmb_parcel090foke_job_idb = mmb_bespoke_job.id  WHERE {$parcel_tb_rel}.mmb_parcele16e_parcel_ida = '{$pid}'  order by due_back_date";
        $result = mysqli_query($con, $sql) or die(mysqli_error() . "Error in " . $sql);
        $row_count = mysqli_num_rows($result);
Exemple #3
0
function Totals($table_name)
{
    if ($table_name == 'jobs' & $_REQUEST['cmd'] != '[HOLD]' & $_REQUEST['cmd'] != '[SEARCH]' & $_REQUEST['cmd'] != '[URGENT]') {
        $sql = "SELECT SUM(max_price) AS TotalChargeEst, SUM(price) AS TotalPrice FROM mmb_bespoke_job";
        if (isset($_REQUEST['sc'])) {
            $sql .= " WHERE job_location = '" . $_REQUEST['sc'] . "'";
        } else {
            $sql .= " WHERE active = 1";
        }
        return DisplayTotals($sql, $table_name);
    } elseif ($table_name == 'parcel_jobs') {
        $parcel_tb_rel = SelectRelTable();
        $sql = "SELECT SUM(max_price) AS TotalChargeEst, SUM(price) AS TotalPrice, SUM(cost) AS TotalCost FROM {$parcel_tb_rel} JOIN mmb_bespoke_job ON {$parcel_tb_rel}.mmb_parcel090foke_job_idb = mmb_bespoke_job.id  WHERE {$parcel_tb_rel}.mmb_parcele16e_parcel_ida = '" . $_REQUEST['pid'] . "'";
        return DisplayTotals($sql, $table_name);
    }
}