Location: PHPKode > projects > PhpRechnung > phpRechnung/offer/posnewf.php
<?php
/*
	posnewf.php

	phpInvoice - is easy-to-use Web-based multilingual accounting software.
	Copyright (C) 2001 - 2008 Edy Corak < phprechnung at ecorak dot net >

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

require_once("../include/phprechnung.inc.php");
CheckUser();
CheckSession();

if(isset($_REQUEST['myID']))
{
	$myID = $_REQUEST['myID'];
}
if(isset($_REQUEST['offerID']))
{
	$offerID = $_REQUEST['offerID'];
}
if(isset($_REQUEST['page']))
{
	$page = $_REQUEST['page'];
}
if(isset($_REQUEST['infoID']))
{
	$infoID = $_REQUEST['infoID'];
}
if(isset($_REQUEST['messageID']))
{
	$messageID = $_REQUEST['messageID'];
}
if(isset($_REQUEST['OfferDate']))
{
	$OfferDate = $_REQUEST['OfferDate'];
}
if(isset($_REQUEST['OfferStatus']))
{
	$OfferStatus = $_REQUEST['OfferStatus'];
}
if(isset($_REQUEST['MethodOfPaymentDate']))
{
	$MethodOfPaymentDate = $_REQUEST['MethodOfPaymentDate'];
}
if(isset($_REQUEST['MethodOfPayment']))
{
	$MethodOfPayment = $_REQUEST['MethodOfPayment'];
}
if(isset($_REQUEST['Note']))
{
	$Note = $_REQUEST['Note'];
}
if(isset($_POST['PosID']))
{
	$PosID = $_POST['PosID'];
}
if(isset($_POST['Pos_Desc']))
{
	$Pos_Desc = $_POST['Pos_Desc'];
}
if(isset($_POST['Pos_Quantity']))
{
	$Pos_Quantity = $_POST['Pos_Quantity'];
}
if(isset($_POST['Pos_Price']))
{
	$Pos_Price = $_POST['Pos_Price'];
}
if(isset($_POST['Pos_Tax']))
{
	$Pos_Tax = $_POST['Pos_Tax'];
}
if(isset($_POST['Pos_Tax_Multi']))
{
	$Pos_Tax_Multi = $_POST['Pos_Tax_Multi'];
}
if(isset($_POST['Pos_Tax_Divide']))
{
	$Pos_Tax_Divide = $_POST['Pos_Tax_Divide'];
}
if(isset($_POST['Pos_Tax_Desc']))
{
	$Pos_Tax_Desc = $_POST['Pos_Tax_Desc'];
}
if(isset($_POST['Pos_Group']))
{
	$Pos_Group = $_POST['Pos_Group'];
}
if(isset($_POST['Pos_Note']))
{
	$Pos_Note = $_POST['Pos_Note'];
}
if(isset($_REQUEST['OfferID1']))
{
	$OfferID1 = $_REQUEST['OfferID1'];
}
if(isset($_REQUEST['CustomerID1']))
{
	$CustomerID1 = $_REQUEST['CustomerID1'];
}
if(isset($_REQUEST['DateFrom1']))
{
	$DateFrom1 = $_REQUEST['DateFrom1'];
}
if(isset($_REQUEST['DateTill1']))
{
	$DateTill1 = $_REQUEST['DateTill1'];
}
if(isset($_REQUEST['Total1']))
{
	$Total1 = $_REQUEST['Total1'];
}
if(isset($_REQUEST['Customer1']))
{
	$Customer1 = $_REQUEST['Customer1'];
}
if(isset($_REQUEST['Order']))
{
	$Order = $_REQUEST['Order'];
}
if(isset($_REQUEST['Sort']))
{
	$Sort = $_REQUEST['Sort'];
}
if(isset($_REQUEST['Canceled']))
{
	$Canceled = $_REQUEST['Canceled'];
}

$Requestedstring = "myID=$myID&offerID=$offerID&infoID=$infoID&messageID=$messageID&OfferDate=$OfferDate&OfferStatus=$OfferStatus&MethodOfPayment=$MethodOfPayment&MethodOfPaymentDate=$MethodOfPaymentDate&Note=$Note&Canceled=$Canceled";

$Searchstring = "OfferID1=$OfferID1&CustomerID1=$CustomerID1&DateFrom1=$DateFrom1&DateTill1=$DateTill1&Total1=$Total1&Customer1=$Customer1";

// Database connection
//
DBConnect();

$query = "INSERT INTO {$TBLName}tmp_offer (TMP_OFFERID, MYID, OFFERID, POSITIONID, USERNAME, POS_DESC, POS_QUANTITY, POS_PRICE, POS_GROUP, TAX, TAX_MULTI, TAX_DIVIDE, TAX_DESC)";
$query .= "VALUES (NULL, '$myID', '$offerID', '$PosID', '$_SESSION[Username]', '$Pos_Desc', '$Pos_Quantity', '$Pos_Price', '$Pos_Group', '$Pos_Tax', '$Pos_Tax_Multi', '$Pos_Tax_Divide', '$Pos_Tax_Desc')";

if ($db->Execute($query) === false)
{
	die($db->ErrorMsg());
}

if(isset($_POST['Next']))
{
	Header("Location: $web/offer/posnew.php?page=$page&$Requestedstring&Order=$Order&Sort=$Sort&$Searchstring&$sessname=$sessid");
} else {
	if(!empty($offerID))
	{
		Header("Location: $web/offer/edit.php?page=$page&$Requestedstring&tmpID=1&Order=$Order&Sort=$Sort&$Searchstring&$sessname=$sessid");
	} else {
		Header("Location: $web/offer/new.php?$Requestedstring&tmpID=1&$sessname=$sessid");
	}		
}
?>
Return current item: PhpRechnung