<?php
require "commonincludefiles.php";
require "_header.php";

include "Numbers/Words.php"; ?>

<div id="main-report" align="center">

	<style type="text/css">
		.table-report {
			font-family: Verdana, Geneva, sans-serif;
			font-size: 12px;
			text-align: left;
			border-right: 0px none;
			border-bottom: 0px none;
		}

		.table-report-inner {
			font-family: Verdana, Geneva, sans-serif;
			font-size: 12px;
		}

		.table-report tr {
			padding: 2px 2px 2px 2px;
		}

		.table-report td {
			padding: 2px 2px 2px 2px;
			border-top: 0px none;
			border-left: 0px none;
		}

		.table-report th {
			padding: 2px 2px 2px 2px;
			background-color: #eee;
			font-weight: bold;
			text-align: left;
			border-top: 0px none;
			border-left: 0px none;
		}

		.college_name {
			font-family: QTAbbie;
			font-size: 35px;
			font-weight: bold;
			padding: 2px 2px 2px 2px;
			text-align: center;
		}

		.college_address {
			font-family: Tahoma, Geneva, sans-serif;
			font-size: 15px;
			text-align: center;
			padding: 2px 2px 2px 2px;
		}
	</style>
	<?php
	if ($_SESSION["cCompany_id"] != "" && isset($_SESSION["cCompany_id"])) {
		$quotation_id = Escape($_REQUEST['ID']);
		$product_name = $_REQUEST['product_name'];
		$product_cost = $_REQUEST['product_cost'];
		$product_rate = $_REQUEST['product_rate'];
		$product_vat1 = $_REQUEST['product_vat1'];
		$product_vat2 = $_REQUEST["product_vat2"];
		$product_servicetax = $_REQUEST['product_servicetax'];
		$quotation_toname = $_REQUEST['quotation_toname'];
		$quotation_toaddress = $_REQUEST['quotation_toaddress'];
		$quotation_referenceby = $_REQUEST['quotation_referenceby'];
		$quotation_subject = $_REQUEST['quotation_subject'];
		$quotation_header = $_REQUEST['quotation_header'];
		$quotation_footer = $_REQUEST['quotation_footer'];
		$quotation_date = $_REQUEST['quotation_date'];
		$quotation_total = $_REQUEST['quotation_total'];

		$query1 = "select * from lms_quotationmaster where quotation_id	= $quotation_id";
		$nw = new Numbers_Words();

		$out = dbQuery($query1);
		if (dbRows($out) > 0) {
			ob_start();

			?>

			<table cellpadding="0" cellspacing="0" border="0" width="90%" frame="box" border="0" cellpadding="0" cellspacing="0"
				style="border: 6px solid black; border-style: solid;">


				<tr>
					<td width="5%"><img border="0" height="100" width="100"
							src="http://auminfosys.com/erp/images/aumlogo1.png" /></td>
					<td width="55%">
						<div style="font-family: Arial Black,Arial Bold,Gadget,sans-serif;">
							<font size="6px">
								<center>Aum Imagineering Pvt.Ltd</center>
							</font>
						</div>
						<div>
							<center>
								<font size="1px">602-603 A, Shapath- 1 Opp.Rajpath Club, S.G.High Way , Ahmedabad -380015
								</font>
							</center>
						</div>
						<div>
							<center>
								<font size="1px">E-mail : jatin@auminfosys.com, URL : http://www.auminfosys.com</font>
							</center>
						</div>
						<div>
							<center>
								<font size="1px"> Phone :(79) 40054004, 26870704 Mobile: 91 98258 47773, 7600001219</font>
							</center>
						</div>
					</td>
				</tr>

				<tr>
					<td colspan="4">
						<hr style="color: #000000; height: 2px; margin-bottom: -5px;">
						<hr style="color: #000000; height: 2px; margin-top: -3px;">
					</td>
				</tr>

				<tr>
					<td align="right" colspan="2">
						<font size="2">Date:<?php print date("d/m/Y", strtotime($quotation_date)); ?></font>
						&nbsp;&nbsp;&nbsp;&nbsp;
					</td>
				</tr>

				<tr>
					<td colspan="2">
						<center>
							<h4>QUOTATION</h4>
						</center><br />
					</td>
				</tr>

				<tr>
					<td colspan="2" align="left"><b>
							<font size="2">&nbsp;&nbsp;To,<font>
						</b></td>
				</tr>
				<tr>
					<td colspan="2" align="left" width="6%"></td>&nbsp;
				</tr>
				<?php
				$row = dbArray($out);
				extract($row);
				?>

				<tr>
					<td align="left" colspan="2">
						<font size="2">&nbsp;&nbsp;<?php print $quotation_toname; ?></font>
					</td>
				</tr>
				<tr>
					<td align="left" colspan="2">
						<font size="2">&nbsp;&nbsp;<?php print ($quotation_toaddress); ?>
							<font></b>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
				</tr>

				<tr>
					<td style="padding-left:155px;" colspan="2">
						<font size="2"><b>Subject : </b><?php print $quotation_subject; ?></font>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
				</tr>
			<?php } ?>

			<tr>
				<td style="padding-left:155px;" colspan="2">
					<font size="2"><b>Your Ref No :</b></font>
				</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td style="padding-left:50px;" colspan="2">
					<font size="2>" <b>We have received inquiry for above mentioned subject. Details of our product and
						Terms are as follows. </b>
				</td>
			</tr>
			<tr>
				<td>&nbsp;</font>
				</td>
			</tr>

			<?php



			$out = dbQuery($query1);

			if (dbRows($out) > 0) {
				?>
				<tr>
					<td align="center" colspan="2">
						<table width="80%" cellpadding="0" cellspacing="0" class="report" frame="box" border="0" cellpadding="0"
							cellspacing="0" width="100%" style="border: 4px solid black; border-style: outset;">
							<tr style="font-weight:bold">

								<td align="center" width="12%">Product Name</td>
								<td align="center" width="6%">Qty</td>

								<td align="center" width="6%">Cost</td>
								<td align="center" width="6%">Tax</td>
								<td align="center" width="6%">Total</td>

							</tr>

							<?php $qty = 0;
							$rate = 0;
							$cost = 0;
							$vat1 = 0;
							$vat2 = 0;
							$tax = 0;
							while ($row = dbArray($out)) {
								extract($row); ?>
								<tr>
									<td align="left" width="25%"><?php print $product_name; ?>
										</br></br>

										<?php
										$tags = explode(',', $quotation_footer);

										foreach ($tags as $key) {

											echo "<ul>- $key</ul>\n";

										}
										?>
										</br></br>
									</td>
									<td align="right" width="6%"><?php print $quotation_quantity; ?></td>

									<td align="right" width="6%">
										<?php print number_format($quotation_quantity * $quotation_cost, 2); ?></td>
									<td align="right" width="6%"><?php print number_format($quotation_tax, 2); ?></td>
									<td align="right"><b><?php print number_format($quotation_total, 2) ?></b></td>
								</tr>
								<?php
								$qty = $qty + $product_qty;
								$rate = $rate + $product_rate;
								$cost = $cost + $product_qty * $product_rate;
								$vat1 = $vat1 + $product_vat1;
								$vat2 = $vat2 + $product_vat2;
								$tax = $tax + $product_servicetax;
							} ?>

							<tr>
								<td align="left" width="71%" colspan="2">
									<b>In Words : </b>
									<?php echo strtoupper($nw->toWords($quotation_total) . " Rupees Only"); ?>

								</td>
								<td align="left" width="71%" colspan="3">
									<center><b>Total : </b>
										<b><?php print number_format($quotation_total, 2) ?></b>
									</center>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
				<tr height="30">
					<td colspan="2">
						<font size="2">&nbsp;&nbsp;Thanking You...</font>
					</td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>


				<tr height="30">
					<td colspan="2">
						<font size="2">&nbsp;&nbsp;For, Aum Imagineering Pvt.Ltd. </font>

					</td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
				<tr height="30">
					<td colspan="2">
						<font size="2">&nbsp;&nbsp;Authorized Signatory</font>
						</br>
						</br>

					</td>
				</tr>
				<tr>

					<td colspan="2">&nbsp;&nbsp;
						<u> <b>
								<font size="2">Terms & Condition:</font>
							</b> </u></br></br>
						<div width="100%" style="vertical-align:top;font-size:13px" align="left">



							&nbsp;&nbsp;01. 100% Payment against delivery by Cheque/Draft in Aum Imagineering Pvt.
							&nbsp;&nbsp;Ltd.,Ahmedabad.<br>
							&nbsp;&nbsp;02. Goods once sold will not be taken back or exchange in any case.<br>
							&nbsp;&nbsp;03. One Year Warranty.<br>
							<br>

						</div>
				</tr>
			</table>
			<?php
			$HtmlCode = ob_get_contents();
			ob_end_flush();

			$HtmlUrl = "report-form-quotation" . $_SESSION["cUserId"] . ".html";
			$HtmlPath = "report/" . $HtmlUrl;
			createHTMLReportPage($header_row_string, $HtmlUrl, $HtmlPath, $HtmlCode);
			?>
			<br />
			<form name="frm" id="frm" action="" method="post">
				<input type="hidden" name="txtFile" id="txtFile" value="<?php echo $HtmlUrl; ?>" />
				<input type="button" name="btnPdf" id="btnPdf" value="Print" onClick="SetPageAction('PRINT');" />
				<input type="button" name="btnPdf" id="btnPdf" value="Create PDF" onclick="SetPageAction('PDF');" />
				<input type="button" name="btnHtml" id="btnHtml" value="Create HTML" onclick="SetPageAction('HTML');" />
				<input type="button" name="btnWord" id="btnWord" value="Create WORD" onclick="SetPageAction('WORD');" />
				<input type="button" name="btnExcel" id="btnExcel" value="Create EXCEL" onclick="SetPageAction('Excel');" />
			</form>
			<script language="javascript" type="text/javascript">
				function SetPageAction(varAction) {
					if (varAction == "PRINT") {
						document.frm.action = "print/create-print.php";
						document.frm.target = "_blank";
						document.frm.submit();
					}
					if (varAction == "PDF") {
						document.frm.action = "convertpdf/quotation-create-pdf.php";
						document.frm.target = "_blank";
						document.frm.submit();
					}
					else if (varAction == "HTML") {
						document.frm.action = "<?php echo $HtmlPath; ?>";
						document.frm.target = "_blank";
						document.frm.submit();
					}
					else if (varAction == "WORD") {
						document.frm.action = "convertword/create-word.php";
						document.frm.target = "_blank";
						document.frm.submit();
					}
					else if (varAction == "Excel") {
						document.frm.action = "convertword/create-excel.php";
						document.frm.target = "_blank";
						document.frm.submit();
					}
				}
			</script>
			<br />
			<br />

		<?php } else {
				echo "<b>No Data Found</b>";
			}
	} else {
		echo "Session Expired";
	}
	?>
</div>
<?php require "_footer.php"; ?>