<?php

// Old name: RPOSum
class purchase_order_status_summary_report extends base_report
{
	public function configure()
	{
		$this->sql = <<<EOSQL

		SELECT
			Customer.Customer,
			PO.MRPVis,
			PO.OrderNo AS OrdNo,
			PO.PODue AS DueDate,
			Customer.Phone,
			tblTerms.Description AS STerms,
			PO.POSta AS OrdSta,
			PO.POMemo,
			TempCus.CustID,
			PO.POTot,
			PO.PORem,
			PO.PODate AS EntryDate,
			ZeroQry.SPOPO AS ZeroID,
			TBAQry.SPOPO AS TBAID,
			PO.VouSta 
		FROM
			((Customer LEFT JOIN
			TempCus ON Customer.CustomerID = TempCus.CustID) INNER JOIN
			(((PO LEFT JOIN
			( 
				SELECT
					SPO.SPOPO 
				FROM
					SPO 
				WHERE
					SPO.UnPri = 0 AND
					SPO.SPOPart Not Like '8 * ' AND
					SPO.SPB > 0 
				GROUP BY
					SPO.SPOPO 
			) AS ZeroQry ON PO.IDPO = ZeroQry.SPOPO
	) LEFT JOIN
	( 
		SELECT
			SPO.SPOPO 
		FROM
			SPO 
		WHERE
			SPO.UnPri Is Null AND
			SPO.SPOPart Not Like '8 * ' AND
			SPO.SPB > 0 
		GROUP BY
			SPO.SPOPO 
	) AS TBAQry ON PO.IDPO = TBAQry.SPOPO) LEFT JOIN
	SPO ON PO.IDPO = SPO.SPOPO) ON Customer.CustomerID = PO.POVen) LEFT JOIN
	tblTerms ON PO.STerms = tblTerms.Terms 
GROUP BY
	Customer.Customer,
	PO.MRPVis,
	PO.OrderNo,
	PO.PODue,
	Customer.Phone,
	tblTerms.Description,
	PO.POSta,
	PO.POMemo,
	TempCus.CustID,
	PO.POTot,
	PO.PORem,
	PO.PODate,
	ZeroQry.SPOPO,
	TBAQry.SPOPO,
	PO.VouSta
EOSQL;

		$this->title = 'PO OVERVIEW REPORT';

		$this->detail_height = 18;

		$this->detail = <<<EOD
			<div class="CName bordered">
				<span>
					{Customer}
				</span>
			</div>
			<div class="OrderNo bordered">
				<span>
					{OrdNo}
				</span>
			</div>
			<div class="PODue bordered center_align">
				<span>
					{DueDate}
				</span>
			</div>
			<div class="POSum bordered right_align">
				<span>
					{=[POTot]-[PORem]}
				</span>
			</div>
			<div class="CPhone bordered">
				<span>
					{Phone}
				</span>
			</div>
			<div class="Text10 bordered right_align">
				<span>
					{POTot}
				</span>
			</div>
			<div class="Text12 bordered">
				<span>
					{POMemo}
				</span>
			</div>
			<div class="Text23 bordered center_align">
				<span>
					{EntryDate}
				</span>
			</div>
EOD;

		$this->report_header_height = 52;

		$this->report_header = <<<EORH
			<div class="Text31">
				<span>
					{title}
				</span>
			</div>
			<div class="Text32">
				<span>
					{subtitle}
				</span>
			</div>
EORH;

		$this->report_footer_height = 49;

		$this->report_footer = <<<EORF
			<div class="Text18 bordered right_align">
				<span>
					{=Sum([POTot])}
				</span>
			</div>
			<div class="Label20 bordered right_align">
				{gray_background}
				<span>
					Total Value
				</span>
			</div>
			<div class="Text19 bordered right_align">
				<span>
					{=Sum([POTot]-[PORem])}
				</span>
			</div>
			<div class="Label21 bordered right_align">
				{gray_background}
				<span>
					Total Received
				</span>
			</div>
EORF;

		$this->page_header_height = 18;

		$this->page_header = <<<EOPH
			<div class="Label0 bordered center_align">
				{gray_background}
				<span>
					Vendor
				</span>
			</div>
			<div class="Label1 bordered center_align">
				{gray_background}
				<span>
					PO #
				</span>
			</div>
			<div class="Label3 bordered center_align">
				{gray_background}
				<span>
					Received
				</span>
			</div>
			<div class="Label2 bordered center_align">
				{gray_background}
				<span>
					Due Date
				</span>
			</div>
			<div class="Label4 bordered center_align">
				{gray_background}
				<span>
					Vendor Phone
				</span>
			</div>
			<div class="Label9 bordered center_align">
				{gray_background}
				<span>
					PO Value
				</span>
			</div>
			<div class="Label11 bordered center_align">
				{gray_background}
				<span>
					Memo
				</span>
			</div>
			<div class="Label22 bordered center_align">
				{gray_background}
				<span>
					Entry Date
				</span>
			</div>
EOPH;

		$this->page_footer_height = 23;

		$this->page_footer = <<<EOPF
			<div class="Text6">
				<span>
					{date_printed}
				</span>
			</div>
			<div class="Text15 right_align">
				<span>
					{page_info}
				</span>
			</div>
EOPF;

		$this->style = <<<EOS

			div.CName {
				top: 0px;
				left: 0px;
				width: 169px;
				height: 17px;
				font-size: 8px;
			}

			div.OrderNo {
				top: 0px;
				left: 170px;
				width: 36px;
				height: 17px;
				font-size: 8px;
			}

			div.PODue {
				top: 0px;
				left: 268px;
				width: 59px;
				height: 17px;
				font-size: 8px;
			}

			div.POSum {
				top: 0px;
				left: 657px;
				width: 74px;
				height: 17px;
				font-size: 8px;
			}

			div.CPhone {
				top: 0px;
				left: 498px;
				width: 82px;
				height: 17px;
				font-size: 8px;
			}

			div.Text10 {
				top: 0px;
				left: 581px;
				width: 75px;
				height: 17px;
				font-size: 8px;
			}

			div.Text12 {
				top: 0px;
				left: 328px;
				width: 169px;
				height: 17px;
				font-size: 8px;
			}

			div.Text23 {
				top: 0px;
				left: 207px;
				width: 60px;
				height: 17px;
				font-size: 8px;
			}

			div.Text31 {
				top: 0px;
				left: 0px;
				width: 733px;
				height: 22px;
				font-size: 12px;
				font-weight: bold;
			}

			div.Text32 {
				top: 22px;
				left: 0px;
				width: 733px;
				height: 30px;
				font-size: 8px;
				font-weight: bold;
			}

			div.Text18 {
				top: 0px;
				left: 623px;
				width: 108px;
				height: 17px;
				font-weight: bold;
			}

			div.Label20 {
				top: 0px;
				left: 517px;
				width: 105px;
				height: 17px;
				font-weight: bold;
			}

			div.Text19 {
				top: 18px;
				left: 623px;
				width: 108px;
				height: 17px;
				font-weight: bold;
			}

			div.Label21 {
				top: 18px;
				left: 517px;
				width: 105px;
				height: 17px;
				font-weight: bold;
			}

			div.Label0 {
				top: 0px;
				left: 0px;
				width: 169px;
				height: 17px;
				font-size: 8px;
			}

			div.Label1 {
				top: 0px;
				left: 170px;
				width: 36px;
				height: 17px;
				font-size: 8px;
			}

			div.Label3 {
				top: 0px;
				left: 657px;
				width: 74px;
				height: 17px;
				font-size: 8px;
			}

			div.Label2 {
				top: 0px;
				left: 268px;
				width: 59px;
				height: 17px;
				font-size: 8px;
			}

			div.Label4 {
				top: 0px;
				left: 498px;
				width: 82px;
				height: 17px;
				font-size: 8px;
			}

			div.Label9 {
				top: 0px;
				left: 581px;
				width: 75px;
				height: 17px;
				font-size: 8px;
			}

			div.Label11 {
				top: 0px;
				left: 328px;
				width: 169px;
				height: 17px;
				font-size: 8px;
			}

			div.Label22 {
				top: 0px;
				left: 207px;
				width: 60px;
				height: 17px;
				font-size: 8px;
			}

			div.Text6 {
				top: 8px;
				left: 0px;
				width: 226px;
				height: 15px;
				font-size: 8px;
				font-weight: bold;
			}

			div.Text15 {
				top: 8px;
				left: 506px;
				width: 226px;
				height: 15px;
				font-size: 8px;
				font-weight: bold;
			}
EOS;

		$this->access_source_code= <<<EOASC
Option Compare Database
Option Explicit

Private Sub Report_Open(Cancel As Integer)
RegSort Me

End Sub
EOASC;

	}
}

?>