コード例 #1
0
ファイル: products.php プロジェクト: DbyD/cruk
                echo "<br><br><br><br>";
                var_dump($data);
                */
                insertProduct($data);
            }
        }
    }
    if (isset($_GET["sub_id"])) {
        $sub_id = $_GET["sub_id"];
    } else {
        $sub_id = null;
        $subs = getMenuSubs($menu_id);
    }
    $res = getMenuProducts($menu_id, $sub_id);
    if (isset($_GET["prID"])) {
        $pr = getProductByID($_GET["prID"]);
    }
} else {
    $res = getTotalProducts();
}
if ($res != 0) {
    $products = $res;
}
?>

<div id="content" class="large-8 large-push-2 columns">
	<div class="title">
		<div class="inlineDiv clickAble" data-type="gourl" data-url="<?php 
echo HTTP_PATH . 'redeem/';
?>
">
コード例 #2
0
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link href="../../css/bootstrap.css" rel="stylesheet">
        <script src="../../cd.js" language="JavaScript" type="text/javascript"></script>
    </head>
    <body>
        <?php 
require_once '../../includes/session-start.req-inc.php';
require_once '../../includes/access-required.html.php';
include_once '../../functions/dbConn.php';
include_once '../../functions/category-functions.php';
include_once '../../functions/products-functions.php';
include_once '../../functions/until.php';
$results = getProductByID();
?>
        
        
        <table border="0">
            <thead>
                <tr>
                    <h2 class="text-center">Products</h2>
                </tr>
            </thead>
            <tbody class="text-center">
            <?php 
foreach ($results as $row) {
    ?>
                <ul class="list-inline">
                   <li><?php 
コード例 #3
0
ファイル: redeem-functions.php プロジェクト: DbyD/cruk
function get_content_email($email_order_code, $tel_number, $delivery_address)
{
    $arr = array();
    $i = $total_price = 0;
    $basket = getBasketByOrder($email_order_code);
    foreach ($basket as $pr_b) {
        $pr_info = getProductByID($pr_b["prID"]);
        $total_price += $pr_b['aPrice'];
        if ($i == 0) {
            $arr[$i]['baID'] = $pr_b['baID'];
            $arr[$i]['aPrice'] = $pr_b['aPrice'];
            $arr[$i]['aTitle'] = $pr_info['aTitle'];
            $arr[$i]['prID'] = $pr_b["prID"];
            $arr[$i]['QTY'] = 1;
            $i++;
        } else {
            $isProduct = false;
            for ($j = 0; $j < count($arr); $j++) {
                if ($pr_b["prID"] == $arr[$j]['prID'] && $pr_b["aPrice"] == $arr[$j]['aPrice']) {
                    $arr[$j]['QTY']++;
                    $arr[$j]['baID'] .= ',' . $pr_b['baID'];
                    $isProduct = true;
                }
            }
            if (!$isProduct) {
                $arr[$i]['baID'] = $pr_b['baID'];
                $arr[$i]['aPrice'] = $pr_b['aPrice'];
                $arr[$i]['aTitle'] = $pr_info['aTitle'];
                $arr[$i]['prID'] = $pr_b["prID"];
                $arr[$i]['QTY'] = 1;
                $i++;
            }
        }
    }
    $i = 1;
    $table_body = '';
    foreach ($arr as $b) {
        $table_body .= '<tr>
								<td>' . $b['QTY'] . '</td>
								<td class="textLeft">' . $b['aTitle'] . '</td>
								<td>&pound;' . $b['aPrice'] . '</td>
							</tr>';
        $i++;
    }
    $table_body .= '<tr>
							<td></td>
							<td class="textRight"><b>Total</b></td>
							<td><b>&pound;' . $total_price . '</b></td>
						</tr>';
    // you need to add content here.
    $content = '<p>Dear ' . $_SESSION['user']->Fname . '</p>
				<p>Thank you for your recent purchase.</p>
				<p><b>Items Purchased</b></p>';
    $content .= '<table id="table_basket" class="invoice" border="0" cellpadding="2" cellspacing="0" >
						<tr>
							<th width="100">QTY</th>
							<th class="textLeft">PRODUCT NAME</th>
							<th width="125">PRICE</th>
						</tr>
						' . $table_body . '
				</table><br>&nbsp;';
    //add shopping basket here in a table
    $content .= '<table id="table_basket" class="details" border="0" cellpadding="2" cellspacing="0" >
					<tr>
						<td width="150"><b>Your order code:</b></td>
						<td> CR' . $email_order_code . ' </td>
					</tr>
					<tr>
						<td><b>Name:</b></td>
						<td>' . $_SESSION['user']->Fname . ' ' . $_SESSION['user']->Sname . '</td>
					</tr>
					<tr>
						<td><b>Email:</b></td>
						<td>' . $_SESSION['user']->Eaddress . '</td>
					</tr>
					<tr>
						<td><b>Telephone Number:</b></td>
						<td>' . $tel_number . '</td>
					</tr>';
    if ($delivery_address != '') {
        $content .= '<tr>
						<td><b>Delivery address:</b></td>
						<td>' . $delivery_address . '</td>
					</tr>';
    }
    $content .= '</table>';
    //add order details here in a table
    $content .= '';
    $content .= '<p>If you have any questions regarding your order, please email <a href="mailto:concierge@xexec.com">concierge@xexec.com</a> or<br>call +44 20 8201 6483 quoting your unique order code.</p>';
    return $content;
}
コード例 #4
0
ファイル: report-functions.php プロジェクト: DbyD/cruk
function createXexecRedemptionExport($post)
{
    global $db;
    setMyCookie($post, 'crukRed');
    $CSVMaster = "<table>";
    $sqlWhere = getRedeemSQL($post["EmpNum"]);
    $dateSQL = getRedeemDates($post, "bo.");
    $sql = "SELECT *\n \t\t\tFROM tblbasket b, tblbasketorders bo, tblempall a\n \t\t\tWHERE b.orderID IS NOT NULL \n\t\t\tAND b.orderID = bo.id \n\t\t\tAND b.EmpNum = a.EmpNum \n\t\t\t" . $sqlWhere . $dateSQL . " ORDER BY bo.id DESC";
    $stmt = $db->prepare($sql);
    $stmt->execute();
    $CSVLine .= "<tr>";
    if ($post["NomineeID"] == "yes") {
        $CSVLine .= "<td>Nominee ID</td>";
    }
    if ($post["Nominee"] == "yes") {
        $CSVLine .= "<td>Nominee</td>";
    }
    if ($post["Department"] == "yes") {
        $CSVLine .= "<td>Department</td>";
    }
    if ($post["NomGrade"] == "yes") {
        $CSVLine .= "<td>Grade</td>";
    }
    if ($post["RedeemDate"] == "yes") {
        $CSVLine .= "<td>Redeem Date</td>";
    }
    if ($post["TransCode"] == "yes") {
        $CSVLine .= "<td>Order Ref</td>";
    }
    if ($post["ProdCat"] == "yes") {
        $CSVLine .= "<td>Product Category</td>";
    }
    if ($post["Product"] == "yes") {
        $CSVLine .= "<td>Product</td>";
    }
    if ($post["AmountSpent"] == "yes") {
        $CSVLine .= "<td>Amount Spent</td>";
    }
    if ($post["CurrentBalance"] == "yes") {
        $CSVLine .= "<td>Current Balance</td>";
    }
    $CSVLine .= "<td>Address 1</td>";
    $CSVLine .= "<td>Address 2</td>";
    $CSVLine .= "<td>Town</td>";
    $CSVLine .= "<td>Postcode</td>";
    $CSVLine .= "</tr>";
    $CSVMaster .= $CSVLine;
    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        $CSVLine = "<tr>";
        $dbline = $row;
        $Nominee = getUser($dbline["EmpNum"]);
        $EmpAwards = getAvailable($dbline["EmpNum"]);
        $ProdData = getProductByID($dbline["prID"]);
        $CCTrans = getCCTransaction($dbline["orderID"]);
        $prodCat = getProductCategory($ProdData["subID"]);
        // We check each field and then add it to the CSV
        if ($post["NomineeID"] == "yes") {
            $CSVLine .= "<td>" . $dbline["EmpNum"] . "</td>";
        }
        if ($post["Nominee"] == "yes") {
            $CSVLine .= "<td>" . Trim($Nominee->Fname) . " " . Trim($Nominee->Sname) . "</td>";
        }
        if ($post["Department"] == "yes") {
            $CSVLine .= "<td>" . Trim($Nominee->Department) . "</td>";
        }
        if ($post["NomGrade"] == "yes") {
            $CSVLine .= "<td>" . Trim($Nominee->Grade) . "</td>";
        }
        if ($post["RedeemDate"] == "yes") {
            $CSVLine .= "<td>" . $dbline["date"] . "</td>";
        }
        if ($post["TransCode"] == "yes") {
            $CSVLine .= "<td>CR" . $dbline["orderID"] . "</td>";
        }
        if ($post["ProdCat"] == "yes") {
            $CSVLine .= "<td>" . Trim($prodCat["label"]) . "</td>";
        }
        if ($post["Product"] == "yes") {
            $CSVLine .= "<td>" . Trim($ProdData["aTitle"]) . "</td>";
        }
        $totalprice = floatval($dbline["totalPrice"]) + floatval($CCTrans->Amount);
        if ($post["AmountSpent"] == "yes") {
            $CSVLine .= "<td>" . Trim($totalprice) . "</td>";
        }
        if ($post["CurrentBalance"] == "yes") {
            $CSVLine .= "<td>" . $EmpAwards . "</td>";
        }
        $CSVLine .= "<td>" . Trim($dbline["address1"]) . "</td>";
        $CSVLine .= "<td>" . Trim($dbline["address2"]) . "</td>";
        $CSVLine .= "<td>" . Trim($dbline["town"]) . "</td>";
        $CSVLine .= "<td>" . Trim($dbline["postcode"]) . "</td>";
        $CSVLine .= "</tr>";
        $CSVMaster .= $CSVLine;
    }
    $CSVMaster .= $CSVLine . "</table>";
    return $CSVMaster;
}
コード例 #5
0
ファイル: product-basket.php プロジェクト: DbyD/cruk
											<tr>
												<th width="100">QTY</th>
												<th class="textLeft">PRODUCT NAME</th>
												<th width="125">PRICE</th>
												<th width="125">REMOVE</th>
											</tr>
										</thead>
										<tbody>
											
											<?php 
    $arr = array();
    $i = 0;
    $delivery = 'no';
    if (!empty($basket)) {
        foreach ($basket as $pr_b) {
            $pr_info = getProductByID($pr_b["prID"]);
            $total_price += $pr_b['aPrice'];
            if ($pr_info['delivery'] == 'yes') {
                $delivery = 'yes';
            }
            if ($i == 0) {
                $arr[$i]['baID'] = $pr_b['baID'];
                $arr[$i]['aPrice'] = $pr_b['aPrice'];
                $arr[$i]['aTitle'] = $pr_info['aTitle'];
                $arr[$i]['prID'] = $pr_b["prID"];
                $arr[$i]['delivery'] = $pr_info["delivery"];
                $arr[$i]['QTY'] = 1;
                $i++;
            } else {
                $isProduct = false;
                for ($j = 0; $j < count($arr); $j++) {
コード例 #6
0
function getExpenseDetails($projectId)
{
    $db = Database::getInstance();
    $conn = $db->getConnection();
    $json_response = array();
    $result_array = array();
    $otherExpense = 0;
    $materialExpense = 0;
    $fail = false;
    $totlaAllocatedBudget = 0;
    $segmentId = "";
    $segmentName = "";
    $totalSegmentExpense = 0;
    $result_array['SegmentExpenseDetails'] = array();
    $stmtBudgetAllocated = $conn->prepare("SELECT `budgetdetailsid`,`projectid`,budget_details.`budgetsegmentid`,budget_segment.segmentname,`allocatedbudget`,`alertlevel` FROM `budget_details`,`budget_segment` WHERE `budget_details`.`projectid`='{$projectId}' AND budget_details.`budgetsegmentid`=budget_segment.`budgetsegmentid`");
    if ($stmtBudgetAllocated->execute()) {
        $totlaAllocatedBudget = 0;
        while ($resultAllocatedBudget = $stmtBudgetAllocated->Fetch(PDO::FETCH_ASSOC)) {
            $totlaAllocatedBudget = $totlaAllocatedBudget + $resultAllocatedBudget['allocatedbudget'];
            $result_array['SegmentBudgetDetails'][] = array('budgetdetailsid' => $resultAllocatedBudget['budgetdetailsid'], 'projectid' => $resultAllocatedBudget['projectid'], 'budgetsegmentid' => $resultAllocatedBudget['budgetsegmentid'], 'segmentname' => $resultAllocatedBudget['segmentname'], 'allocatedbudget' => $resultAllocatedBudget['allocatedbudget'], 'alertlevel' => $resultAllocatedBudget['alertlevel']);
        }
        $result_array['SegmentsTotalBudgetAllocated'] = $totlaAllocatedBudget;
    } else {
        $totlaAllocatedBudget = 0;
    }
    $stmtMaterialBudgetAllocated = $conn->prepare("SELECT `materialbudgetdetailsid`,material_budget_details.`materialid`,`allocatedbudget`,`alertlevel`,product_master.productname FROM `material_budget_details`,material,product_master WHERE `material_budget_details`.`projectid`='{$projectId}' And material_budget_details.materialid =material.materialid AND material.productmasterid=product_master.productmasterid");
    if ($stmtMaterialBudgetAllocated->execute()) {
        $totalMaterialBudget = 0;
        while ($resultAllocatedMaterialBudget = $stmtMaterialBudgetAllocated->Fetch(PDO::FETCH_ASSOC)) {
            $totalMaterialBudget = $totalMaterialBudget + $resultAllocatedMaterialBudget['allocatedbudget'];
            $totlaAllocatedBudget = $totlaAllocatedBudget + $resultAllocatedMaterialBudget['allocatedbudget'];
            $result_array['MaterialBudgetDetails'][] = array('materialbudgetdetailsid' => $resultAllocatedMaterialBudget['materialbudgetdetailsid'], 'materialid' => $resultAllocatedMaterialBudget['materialid'], 'productname' => $resultAllocatedMaterialBudget['productname'], 'allocatedbudget' => $resultAllocatedMaterialBudget['allocatedbudget'], 'alertlevel' => $resultAllocatedMaterialBudget['alertlevel']);
        }
        $result_array['MaterialsTotalBudgetAllocated'] = $totalMaterialBudget;
    }
    $stmt = $conn->prepare("SELECT `budget_details`.`projectid`,`budget_details`.`budgetsegmentid`,`budget_details`.`allocatedbudget`,`budget_details`.`alertlevel`,`segmentname`,SUM(`amount`) AS totalExpense FROM `budget_details` INNER JOIN `expense_details` ON `expense_details`.`budgetsegmentid`=`budget_details`.`budgetsegmentid` AND `budget_details`.`projectid`='{$projectId}' JOIN `budget_segment` ON `budget_segment`.`budgetsegmentid`=`budget_details`.`budgetsegmentid` GROUP BY `budget_details`.`budgetsegmentid`");
    if ($stmt->execute()) {
        while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $result_array['projectName'] = $result['projectid'];
            $segmentWiseExpense = array();
            $segmentWiseExpense['segmentId'] = $result['budgetsegmentid'];
            $segmentWiseExpense['segmentName'] = $result['segmentname'];
            $segmentWiseExpense['allocatedBudget'] = $result['allocatedbudget'];
            if ($result['totalExpense'] != "") {
                $segmentWiseExpense['totalSegmentExpense'] = $result['totalExpense'];
            } else {
                $segmentWiseExpense['totalSegmentExpense'] = 0;
            }
            $segmentWiseExpense['alertLevel'] = $result['alertlevel'];
            $stmt1 = $conn->prepare("SELECT expensedetailsid,`projectid`,budgetsegmentid,amount,description  FROM `expense_details` WHERE projectid='{$projectId}' AND budgetsegmentid='{$result['budgetsegmentid']}'");
            if ($stmt1->execute()) {
                $segmentWiseExpense['SegmentExpense'] = array();
                while ($expenseResult = $stmt1->fetch(PDO::FETCH_ASSOC)) {
                    $billId = "--";
                    $billno = "--";
                    $amount = "--";
                    $billissueingentity = "--";
                    $dateofbill = "--";
                    $stmtBillDetails = $conn->prepare("select * FROM unapproved_expense_bills WHERE expensedetailsid='{$expenseResult['expensedetailsid']}'");
                    if ($stmtBillDetails->execute()) {
                        $resultBillDetails = $stmtBillDetails->fetch(PDO::FETCH_ASSOC);
                        $billId = $resultBillDetails['billid'];
                        if ($billId == "") {
                            $billId = "--";
                        }
                        $billno = $resultBillDetails['billno'];
                        if ($billno == "") {
                            $billno = "--";
                        }
                        $amount = $resultBillDetails['amount'];
                        if ($amount == "") {
                            $amount = "--";
                        }
                        $billissueingentity = $resultBillDetails['billissueingentity'];
                        if ($billissueingentity == "") {
                            $billissueingentity = "--";
                        }
                        $dateofbill = $resultBillDetails['dateofbill'];
                        if ($dateofbill == "") {
                            $dateofbill = "--";
                        } else {
                            $newDate = date("d-m-Y", strtotime($resultBillDetails['dateofbill']));
                            $dateofbill = $newDate;
                        }
                    }
                    $segmentWiseExpense['SegmentExpense'][] = array('segmentName' => $result['segmentname'], 'budgetsegmentidExpenseDetails' => $expenseResult['budgetsegmentid'], 'amountExpenseDetails' => $expenseResult['amount'], 'descriptionExpenseDetails' => $expenseResult['description'], 'billId' => $billId, 'billNo' => $billno, 'billAmount' => $amount, 'billissueingentity' => $billissueingentity, 'dateofbill' => $dateofbill);
                    $otherExpense = $otherExpense + $expenseResult['amount'];
                }
            }
            array_push($result_array['SegmentExpenseDetails'], $segmentWiseExpense);
        }
    } else {
    }
    //    array_push($result_array,$segmentWiseExpense);
    $totalMaterialExpense = 0;
    $stmt2 = $conn->prepare("SELECT materialexpensedetailsid,materialid,quantity,amount,description  FROM `material_expense_details` WHERE projectid='{$projectId}' ");
    if ($stmt2->execute()) {
        while ($result = $stmt2->fetch(PDO::FETCH_ASSOC)) {
            //GET BILL DETAILS
            $billId = "--";
            $billno = "--";
            $amount = "--";
            $billissueingentity = "--";
            $dateofbill = "--";
            $materialId = $result['materialid'];
            $material = getProductByID($materialId);
            //InventoryUtils::getProductById($materialId);
            $stmtBillDetails = $conn->prepare("select * FROM material_expense_bills WHERE materialexpensedetailsid='{$result['materialexpensedetailsid']}'");
            if ($stmtBillDetails->execute()) {
                $resultBillDetails = $stmtBillDetails->fetch(PDO::FETCH_ASSOC);
                $billId = $resultBillDetails['billid'];
                $billno = $resultBillDetails['billno'];
                if ($billno == "") {
                    $billno = "--";
                }
                $amount = $resultBillDetails['amount'];
                if ($amount == "") {
                    $amount = "--";
                }
                $billissueingentity = $resultBillDetails['billissueingentity'];
                if ($billissueingentity == "") {
                    $billissueingentity = "--";
                }
                $dateofbill = $resultBillDetails['dateofbill'];
                if ($dateofbill == "") {
                    $dateofbill = "--";
                } else {
                    $newDate = date("d-m-Y", strtotime($resultBillDetails['dateofbill']));
                    $dateofbill = $newDate;
                }
            }
            $result_array['materialExpenseDetails'][] = array('quantity' => $result['quantity'], 'amountMaterialExpenseDetails' => $result['amount'], 'descriptionMaterialExpenseDetails' => $result['description'], 'billId' => $billId, 'billNo' => $billno, 'billAmount' => $amount, 'billissueingentity' => $billissueingentity, 'dateofbill' => $dateofbill, 'materialID' => $materialId, 'material' => $material);
            $totalMaterialExpense = $totalMaterialExpense + $result['amount'];
        }
        $result_array['materialExpense'] = $totalMaterialExpense;
    } else {
        $fail = true;
    }
    $totalExpense = $otherExpense + $totalMaterialExpense;
    $result_array['totalExpenditure'] = $totalExpense;
    $result_array['otherExpense'] = $otherExpense;
    $result_array['budgetAllocated'] = $totlaAllocatedBudget;
    array_push($json_response, $result_array);
    $json = json_encode($json_response);
    echo $json;
}