session_start();
//create handle for new PDF document
$pdf = PDF_new();
//open a file pdf_open_file
PDF_open_file($pdf, "");
//start a new page
PDF_begin_page($pdf, 595, 842);
//get and use a font object
$font = PDF_findfont($pdf, "Times-Roman", "host", 0);
PDF_setfont($pdf, $font, 12);
/*print text*/
// PULLING OF DATA AND OTHER PRINTING INFORMATION------------------------
include 'dbFunctions.php';
$consign_query = "SELECT \r\nSUM(rs.product_qty) AS product_qty, \r\nSUM(rs.sold_price) AS sold_final_price, \r\nSUM(rs.sales_price) AS sales_final_price,\r\ns.supplier_name,\r\ns.supplier_consignment,\r\ns.supplier_id \r\nFROM resolvesale rs, product p, category c, resolvecategory rc, supplier s \r\nWHERE time_of_sale BETWEEN '{$year1}-{$month1}-{$day1} 00:00:01' AND '{$year2}-{$month2}-{$day2} 23:59:59'\r\nAND rs.product_id = p.product_id\r\nAND p.category_id = c.category_id\r\nAND c.category_id = rc.category_id\r\nAND rc.supplier_id = s.supplier_id \r\nGROUP BY s.supplier_id";
// EXECUTE QUERY AND RETRIEVE ALL THE DATA I NEED -----------------------
$printconsign = executeSelectQuery($consign_query);
$generatedfrom = $_POST['generatedfrom'];
$selectedto = $_POST['selectedto'];
$supplier_name = $_POST['supplier_name'];
$supplier_consignment = $_POST['supplier_consignment'];
$product_qty = $_POST['product_qty'];
$sales_final_price = $_POST['sales_final_price'];
$sold_final_price = $_POST['sold_final_price'];
$payment_to_supplier = $_POST['payment_to_supplier'];
$total_consignment = $_POST['total_money'];
$images = PDF_load_image($pdf, 'jpeg', 'C:\\xampp\\htdocs\\pdf\\images\\dulce.jpeg', '');
$reportheader = " CONSIGNMENT REPORT ";
$timestamp = getdate();
$reference = "REF-";
$reportl1 = "REPORT GENERATED FROM:   {$generatedfrom}";
$reportl2 = "TO:   {$selectedto}";
Пример #2
0
if ($_SESSION['role'] == 'admin' || $_COOKIE['role'] == 'admin') {
    $email_add = $_GET['email_add'];
    include 'dbFunctions.php';
    $sql = "(SELECT role FROM teacher WHERE email_add = '{$email_add}') UNION (SELECT  role FROM registereduser WHERE email_add = '{$email_add}') ";
    $result = mysqli_query($connect, $sql);
    while ($runrows = mysqli_fetch_array($result)) {
        $role = $runrows['role'];
    }
    if ($role == 'teacher') {
        $teachersql = "SELECT * FROM teacher WHERE email_add = '{$email_add}'";
        $teacherResult = mysqli_query($connect, $teachersql);
        while ($runrows = mysqli_fetch_array($teacherResult)) {
            $personID = $runrows['teacher_id'];
        }
        // to delete the image stored for teacher
        $m = executeSelectQuery(" SELECT * FROM teacher WHERE teacher_id = '{$personID}' ");
        $path = 'teacherimage/';
        unlink($path . $m[0]['image']);
        // delete comment with the teacher id & relation & video
        mysqli_query($connect, "DELETE FROM `comment` WHERE teacher_id ='{$personID}' ") or die(mysqli_error());
        mysqli_query($connect, "DELETE FROM `relation` WHERE teacher_id ='{$personID}' ") or die(mysqli_error());
        mysqli_query($connect, "DELETE FROM `videos` WHERE teacher_id ='{$personID}' ") or die(mysqli_error());
        mysqli_query($connect, "DELETE FROM `resolvecategory` WHERE teacher_id ='{$personID}' ") or die(mysqli_error());
        // to delete the whole account.
        mysqli_query($connect, "DELETE FROM `teacher` WHERE teacher_id ='{$personID}' ") or die(mysqli_error());
        $deletesuccess = "The particular user have been deleted successfully.";
        echo $deletesuccess;
    }
    if ($role == 'student') {
        $studentsql = "SELECT * FROM registereduser WHERE email_add = '{$email_add}'";
        $studentresult = mysqli_query($connect, $studentsql);
     mysqli_query($connect, "UPDATE  `teacher` SET `image` = '{$image}' WHERE email_add = '{$email_add2}' ") or die(mysql_error());
     if (($_FILES["uploadedfile"]["type"] == "image/gif" || $_FILES["uploadedfile"]["type"] == "image/jpeg" || $_FILES["uploadedfile"]["type"] == "image/png" || $_FILES["uploadedfile"]["type"] == "image/pjpeg" || $_FILES["uploadedfile"]["type"] == "image/jpg") && $_FILES["uploadedfile"]["size"] < 50000000) {
         if ($_FILES["file"]["error"] > 0) {
             $errorimage = "Return Code: " . $_FILES["uploadedfile"]["error"] . "<br />";
         } else {
             if (file_exists("administrator/teacherimage/" . $_FILES["uploadedfile"]["name"])) {
                 $imageexist = "The image already exist. Not possible to enter another one.<br/><br/>";
                 $imagename = $_FILES["uploadedfile"]["name"] . " already exists. <br/>\r\n\t\t\t\t<input type=button value='Go Back!' onclick='history.back(-1)' /><br/>";
             } else {
                 move_uploaded_file($_FILES["uploadedfile"]["tmp_name"], "administrator/teacherimage/" . $_FILES["uploadedfile"]["name"]);
                 $success = "You have sucessfully change your picture";
             }
         }
     }
 } else {
     $m = executeSelectQuery("SELECT image FROM portalmanager WHERE email_add = '{$email_add2}' ");
     $path = 'administrator/portalmanagerimage/';
     unlink($path . $m[0]['image']);
     mysqli_query($connect, "UPDATE  `portalmanager` SET `image` = '{$image}' WHERE email_add = '{$email_add2}' ") or die(mysql_error());
     if (($_FILES["uploadedfile"]["type"] == "image/gif" || $_FILES["uploadedfile"]["type"] == "image/jpeg" || $_FILES["uploadedfile"]["type"] == "image/png" || $_FILES["uploadedfile"]["type"] == "image/pjpeg" || $_FILES["uploadedfile"]["type"] == "image/jpg") && $_FILES["uploadedfile"]["size"] < 50000000) {
         if ($_FILES["file"]["error"] > 0) {
             $errorimage = "Return Code: " . $_FILES["uploadedfile"]["error"] . "<br />";
         } else {
             if (file_exists("administrator/portalmanagerimage/" . $_FILES["uploadedfile"]["name"])) {
                 $imageexist = "The image already exist. Not possible to enter another one.<br/><br/>";
                 $imagename = $_FILES["uploadedfile"]["name"] . " already exists. <br/>\r\n\t\t\t\t<input type=button value='Go Back!' onclick='history.back(-1)' /><br/>";
             } else {
                 move_uploaded_file($_FILES["uploadedfile"]["tmp_name"], "administrator/portalmanagerimage/" . $_FILES["uploadedfile"]["name"]);
                 $success = "You have sucessfully change your picture";
             }
         }
        $expenditure[$index] = $expenditure_report[0][0];
    }
    if ($sMonth + 1 == 13) {
        $sMonth = 1;
        $sYear++;
    } else {
        $sMonth++;
    }
    $index++;
}
for ($i = 0; $i < $year_difference; $i++) {
    for ($j = 0; $j <= 11; $j++) {
        $month = dates($sMonth, $sYear);
        $expenditure_report = executeSelectQuery("SELECT sum(total_amount) FROM expenditure WHERE date BETWEEN '{$month['0']}' AND '{$month['1']}'");
        $revenue_report = executeSelectQuery("SELECT sum(sold_price) FROM resolvesale WHERE DATE_FORMAT(time_of_sale,'%Y-%m-%d') BETWEEN '{$month['0']}' AND '{$month['1']}'");
        $cogs_report = executeSelectQuery("SELECT sum(cost_price) FROM resolvesale WHERE DATE_FORMAT(time_of_sale,'%Y-%m-%d') BETWEEN '{$month['0']}' AND '{$month['1']}'");
        if ($cogs_report[0][0] == null) {
            $cogs[$index] = 0;
        } else {
            $cogs[$index] = $cogs_report[0][0];
        }
        if ($revenue_report[0][0] == null) {
            $revenue[$index] = 0;
        } else {
            $revenue[$index] = $revenue_report[0][0];
        }
        if ($expenditure_report[0][0] == null) {
            $expenditure[$index] = 0;
        } else {
            $expenditure[$index] = $expenditure_report[0][0];
        }
session_start();
//create handle for new PDF document
$pdf = PDF_new();
//open a file pdf_open_file
PDF_open_file($pdf, "");
//start a new page
PDF_begin_page($pdf, 595, 842);
//get and use a font object
$font = PDF_findfont($pdf, "Times-Roman", "host", 0);
PDF_setfont($pdf, $font, 12);
/*print text*/
// PULLING OF DATA AND OTHER PRINTING INFORMATION------------------------
include 'dbFunctions.php';
$revenuequery = "SELECT \r\nSUM(rs.product_qty) AS product_qty, \r\nSUM(rs.sold_price) AS sold_final_price, \r\nSUM(rs.sales_price) AS sales_final_price,\r\np.product_name\r\nFROM resolvesale rs, product p, category c, resolvecategory rc, supplier s \r\nWHERE time_of_sale BETWEEN '{$year1}-{$month1}-{$day1} 00:00:01' AND '{$year2}-{$month2}-{$day2} 23:59:59'\r\nAND rs.product_id = p.product_id\r\nAND p.category_id = c.category_id\r\nAND c.category_id = rc.category_id\r\nAND rc.supplier_id = s.supplier_id \r\nGROUP BY rs.product_code\r\nORDER BY SUM(rs.product_qty) DESC";
// EXECUTE QUERY AND RETRIEVE ALL THE DATA I NEED -----------------------
$printrevenue = executeSelectQuery($revenuequery);
$generatedfrom = $_POST['generatedfrom'];
$selectedto = $_POST['selectedto'];
$product_name = $_POST['product_name'];
$product_qty = $_POST['product_qty'];
$sales_final_price = $_POST['sales_final_price'];
$sold_final_price = $_POST['sold_final_price'];
$total_qty_sold = $_POST['total_qty_sold'];
$total_amt_revenue = $_POST['total_amt_revenue'];
$images = PDF_load_image($pdf, 'jpeg', 'C:\\xampp\\htdocs\\pdf\\images\\dulce.jpeg', '');
$revpermonth = " REVENUE REPORT ";
$timestamp = getdate();
$reference = "REF-";
$reportl1 = "REPORT GENERATED FROM:   {$generatedfrom} ";
$reportl2 = "TO:   {$selectedto} ";
$productheader = "PRODUCT NAME";
PDF_begin_page($pdf, 595, 842);
//get and use a font object
$font = PDF_findfont($pdf, "Times-Roman", "host", 0);
PDF_setfont($pdf, $font, 12);
/*print text*/
include 'dbFunctions.php';
//GET STAFF'S NAME ------------------------------------------------------
if (isset($_SESSION['name'])) {
    $name = $_SESSION['name'];
}
if (isset($_COOKIE['name'])) {
    $name = $_COOKIE['name'];
}
//PULLING OF DATA AND OTHER PRINTING INFORMATION ------------------------
$query = "SELECT s.sales_id, s.time_of_sale, s.user_id, s.sales_type, s.vip_id, r.sales_price, r.sold_price, r.promotion_name, c.first_name FROM resolvesale r, sales s, customer c WHERE r.sales_id = '{$sales_id}' AND s.vip_id = c.vip_id ";
$receipt = executeSelectQuery($query);
$items = $_POST['productName'];
$price = $_POST['productPrice'];
$orgprice = $_POST['productOrgPrice'];
$discounts = $_POST['productDiscount'];
$quantitys = $_POST['productQty'];
$code = $_POST['productCode'];
$vipFirstName = $_POST['vipFirstName'];
$vipLastName = $_POST['vipLastName'];
$paymentmode = $_POST['paymentType'];
$gave = $_POST['paymentReceived'];
$amounts = $_POST['final_total_sold'];
$change = $_POST['change_money_to_customer'];
$sales_id = $_POST['sales_id'];
$final_discount_name = $_POST['final_discount_name'];
$total_original_price = $_POST['total_original_price'];