示例#1
0
    function showReportGeneralPREPSchoolBySupplier($intYearMonth)
    {
        global $STR_URL;
        $intMonth = intval(substr($intYearMonth, -2, 2));
        $intYear = intval(substr($intYearMonth, 0, 4));
        $strReportTitle = HTML::getMonthName($intMonth) . " " . $intYear . " PREP School";
        ?>

		<div style="clear:both;text-align:center;"><h2><?php 
        echo $strReportTitle;
        ?>
</h3></div>
		<div style="clear:both;"><h3 style="font-size:1.3em;">Report by Supplier</h3></div>
		<table class="table table-bordered table-hover">
			<thead class="well">					
				<tr>
					<th style="text-align:center;"><strong>Supplier</strong></th>
					<th style="text-align:center;">Product</th>
					<th style="text-align:center;">Date</th>					
				</tr>
			</thead>
			<tbody>				
				<?php 
        $queryProduct = "SELECT * FROM `mbs_bookings_products` t1, \n\t\t\t\t\t\t\t\t\t\t\t\t   `mbs_bookings_activities` t2,  \n\t\t\t\t\t\t\t\t\t\t\t\t   `mbs_bookings` t3,\n\t\t\t\t\t\t\t\t\t\t\t\t   `mbs_suppliers` t4,\n\t\t\t\t\t\t\t\t\t\t\t\t   `mbs_activities` t5\n\t\t\t\t\t\t\t\t\t\t\t WHERE t1.`booking_activity_id` = t2.`booking_activity_id` \n\t\t\t\t\t\t\t\t\t\t\t AND t1.`booking_id` = t3.`booking_id`\n\t\t\t\t\t\t\t\t\t\t\t AND t3.`supplier_id` = t4.`supplier_id` \n\t\t\t\t\t\t\t\t\t\t\t AND t5.`activity_id` = t2.`activity_id` \n\t\t\t\t\t\t\t\t\t\t\t AND t5.`activity_name` LIKE '%PREP School%'\n\t\t\t\t\t\t\t\t\t\t\t AND t2.`booking_activity_year` = " . $intYear . " \n\t\t\t\t\t\t\t\t\t\t\t AND t2.`booking_activity_month` = " . $intMonth . "\n\t\t\t\t\t\t\t\t\t\t\t ORDER BY t4.`supplier_name`, t1.`booking_product_name`";
        //echo $queryProduct;
        $resultProduct = mysql_query($queryProduct);
        if ($resultProduct) {
            if (mysql_num_rows($resultProduct) > 0) {
                $i = 0;
                $data = array();
                while ($rowProduct = mysql_fetch_assoc($resultProduct)) {
                    $data[$i] = $rowProduct['supplier_id'];
                    $i++;
                    $intSupplierID = DB::dbIDToField('mbs_bookings', 'booking_id', $rowProduct['booking_id'], 'supplier_id');
                    $strSupplierName = DB::dbIDToField('mbs_suppliers', 'supplier_id', $intSupplierID, 'supplier_name');
                    $strActivitySize = DB::dbIDToField('mbs_sizes', 'size_id', $rowProduct['size_id'], 'size_name');
                    $intPagesTally = REPORT::getPagesTally($rowProduct['size_id']);
                    if ($data[$i - 1] !== $data[$i - 2]) {
                        ?>
		
								<tr>
									<td style="text-align:left;" colspan="4"><strong><?php 
                        echo stripslashes($strSupplierName);
                        ?>
</strong></td>
								</tr>
							<?php 
                    }
                    ?>
								<tr>
									<td style="text-align:right;"><?php 
                    echo $i;
                    ?>
</td>								
									<td style="text-align:left;"><?php 
                    echo stripslashes($rowProduct['booking_product_name']);
                    ?>
</td>
									<td style="text-align:left;"><?php 
                    echo stripslashes(HTML::convertDate($rowProduct['booking_date']));
                    ?>
</td>								
									
								</tr>

							<?php 
                }
                // while($rowProduct)
            } else {
                ?>
							<tr>
								<td colspan="4"><div style="text-align:center;"><em>No data was found</em></div></td>	
							</tr>
							<?php 
            }
        }
        // if ($resultProduct)
        ?>

			</tbody>
			<tfoot>
			</tfoot>
		</table>	

		<?php 
        // The Log
        $strLog = "View PREP School by Month by Supplier Report for \"" . HTML::getMonthName($intMonth) . " " . $intYear . "\"";
        $queryLog = "INSERT INTO `logs` (`log_id`, \n\t\t\t\t\t\t\t\t\t\t `log_user`, \n\t\t\t\t\t\t\t\t\t\t `log_action`, \n\t\t\t\t\t\t\t\t\t\t `log_time`, \n\t\t\t\t\t\t\t\t\t\t `log_from`, \n\t\t\t\t\t\t\t\t\t\t `log_logout`)\n\n\t\t\t\t\tVALUES (NULL, \n\t\t\t\t\t\t\t'" . $_SESSION['user']['login_name'] . "',\n\t\t\t\t\t\t\t'" . mysql_real_escape_string($strLog) . "',\n\t\t\t\t\t\t\t'" . date('Y-m-d H:i:s') . "',\n\t\t\t\t\t\t\t'" . $_SESSION['user']['ip_address'] . "', \n\t\t\t\t\t\t\tNULL)";
        $resultLog = mysql_query($queryLog);
    }