Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,665 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,167 people online right now. Registration is fast and FREE... Join Now!




This must be easy for you guys

 
Reply to this topicStart new topic

This must be easy for you guys

edlentz
post 28 Jul, 2007 - 01:19 PM
Post #1


New D.I.C Head

*
Joined: 28 Jul, 2007
Posts: 3


My Contributions


What I want to do here is use the cf_455 info (which is either a 1 or 0) to do some simple math ie: If cf_455 is 1 then I want the $taxtotal to be the product of subtotal * .06 and then be displayed in the table marked Sales Tax. With what I have below (marked in Red, if I did it right) all I get is a blank screen. Would someone care to comment on what I have done wrong?

Thanks Alot!!

CODE
$quoteinfo = "SELECT
`vtiger_quotes`.`quoteid`,
`vtiger_quotesbillads`.`bill_city`,
`vtiger_quotesbillads`.`bill_code`,
`vtiger_quotesbillads`.`bill_street`,
`vtiger_quotesbillads`.`bill_state`,
`vtiger_quotesshipads`.`ship_city`,
`vtiger_quotesshipads`.`ship_code`,
`vtiger_quotesshipads`.`ship_state`,
`vtiger_quotesshipads`.`ship_street`,
`vtiger_quotes`.`accountid`,
`vtiger_account`.`accountname`,
`vtiger_quotes`.`total`,
`vtiger_quotes`.`adjustment`,
`vtiger_quotes`.`subtotal`,
`vtiger_quotes`.`contactid`,
`vtiger_quotes`.`validtill`,
`vtiger_quotes`.`terms_conditions`,
`vtiger_quotes`.`s_h_amount`,
`vtiger_accountscf`.`cf_455`
FROM
`vtiger_quotesbillads`
Inner Join `vtiger_quotesshipads` ON `vtiger_quotesbillads`.`quotebilladdressid` = `vtiger_quotesshipads`.`quoteshipaddressid`
Inner Join `vtiger_quotes` ON `vtiger_quotes`.`quoteid` = `vtiger_quotesbillads`.`quotebilladdressid`
Inner Join `vtiger_account` ON `vtiger_quotes`.`accountid` = `vtiger_account`.`accountid`
Inner Join `vtiger_accountscf` ON `vtiger_accountscf`.`accountid` = `vtiger_account`.`accountid`
WHERE
`vtiger_quotes`.`quoteid` =  '$record'";

$result = mysql_query($quoteinfo);
while ($row = mysql_fetch_assoc($result)) {
echo "<table>";
echo "<table border=\"2\" align=\"center\" width=\"500\"><Caption>          Billing and Installation Address</caption";

echo "<tr><td>".$row['bill_street']."</td><td>".$row['ship_street']."</td></tr>";
echo "<tr><td>".$row['bill_city']."</td><td>".$row['ship_city']."</td></tr>";
echo "<tr><td>".$row['bill_state']."</td><td>".$row['ship_state']."</td></tr>";
echo "<tr><td>".$row['bill_code']."</td><td>".$row['ship_code']."</td></tr>";
echo "</table><br/>";
}


$result = mysql_query($quoteinfo);
while ($row = mysql_fetch_assoc($result)) {
echo "<table>";
echo "<table border=\"2\" align=\"center\" width=\"700\"><Caption>Proposal Synopsis</caption";
echo "<tr><td>".$row['description']."</td><td>";
echo "</table><br/>";
}
include ('include/baaGrid.php');
$queryString1 = "SELECT
`vtiger_inventoryproductrel`.`productid`,
`vtiger_products`.`productid`,
`vtiger_inventoryproductrel`.`quantity`,
`vtiger_inventoryproductrel`.`listprice`,
`vtiger_products`.`productname`,
`vtiger_products`.`product_description`,
`vtiger_inventoryproductrel`.`id`,
`vtiger_inventoryproductrel`.`tax2`
FROM
`vtiger_inventoryproductrel`
Inner Join `vtiger_products` ON `vtiger_inventoryproductrel`.`productid` = `vtiger_products`.`productid`
WHERE
`vtiger_inventoryproductrel`.`id` =  '$record'";
//***********This is where we build the Table*************************
    $grid = new baaGrid($queryString1);
    $grid->setTableAttr('border="2" cellspacing="1" width="700" ');
    $grid->setDateFormat('d M y');
    //$grid->setHeadings("productid,quantity,listprice");
    $grid->hideColumn(0);
    $grid->hideColumn(1);
    $grid->hideColumn(3);
    $grid->hideColumn(6);
    $grid->hideColumn(7);
    $grid->setAlign(4,c);
    $grid->setHeadings("productid,productid,Qty.,price,Part No.,Description,id,tax");
    $grid->setHeaderClass('head1');
    $grid->setColClass('data2,data1');
    $grid->display();
//mysql_close($conn)

//************Totals Area**********************
$taxstatus = 'cf_455'
if $taxstatus = '1' then $taxtotal = ('subtotal'* .06);

$result = mysql_query($quoteinfo);
while ($row = mysql_fetch_assoc($result)) {
echo "<table>";
echo "<table border=\"2\" align=\"center\" width=\"500\"><Caption>Proposal Totals</caption";

echo "<tr><td>SubTotal</td><td>".$row['subtotal']."</td></tr>";
echo "<tr><td>Adjustment</td><td>".$row['adjustment']."</td></tr>";
echo "<tr><td>Sales Tax</td><td>".$row['$taxtotal']."</td></tr>";
echo "<tr><td>Labor Total</td><td>".$row['s_h_amount']."</td></tr>";
echo "<tr><td>Grand Total</td><td>".$row['total']."</td></tr>";


[mod edit] how come code tags are so hard to comprehend?
User is offlineProfile CardPM

Go to the top of the page

snoj
post 28 Jul, 2007 - 06:00 PM
Post #2


$Null

Group Icon
Joined: 31 Mar, 2003
Posts: 3,304



Thanked 5 times

Dream Kudos: 700
My Contributions


If you're only getting a blank screen, it could be that there is some parser error and the host has the display of errors turned off.
User is offlineProfile CardPM

Go to the top of the page

edlentz
post 30 Jul, 2007 - 07:40 PM
Post #3


New D.I.C Head

*
Joined: 28 Jul, 2007
Posts: 3


My Contributions


QUOTE(hotsnoj @ 28 Jul, 2007 - 07:00 PM) *

If you're only getting a blank screen, it could be that there is some parser error and the host has the display of errors turned off.


Yes the display errors is turned off, it will interfere with my CRM. If it won't work on the page I have would it work to load a separate page to so the math and then redirect to the page with the information on it?

Thanks
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 05:48AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month