Jump to content

kat35601

Members
  • Posts

    182
  • Joined

  • Last visited

Everything posted by kat35601

  1. No I have not tried with all the html removed I will try that now.
  2. Yes we are a little off track from my original question. How do I get <?php include 'bs_kf_production_price_week.php';echo "<p>| Week</p> "?> or <p><?php include 'bs_kf_production_price_week.php';| Week</p> "?> to print on one line?
  3. Let me give a little more information. I have about 75 pages like this that I want to pull one or two numbers off of to put on one page. All have different SQL Databases and Tables that they pull from.
  4. <html> <head> <title>Production</title> </head> <body> <div class="wrapper"> <?php $grandTotal = 0; $connect =odbc_connect("removed"); if(!$connect) { exit("Connection Failed: " . $connect); } $sql=" SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, tdate)) AS DATE ,ISNULL(trans, 'NON') AS trans ,ISNULL(Transactions.item, Snumbers.item) AS item ,count(serial) AS qty ,tuser ,sum(M1_KF.dbo.PartUnitSalePrices.imhUnitSalePrice) as TotalPrice FROM Orbedata.dbo.SNumbers LEFT OUTER JOIN OrbeData.dbo.Transactions ON snum = serial INNER JOIN M1_KF.dbo.PartUnitSalePrices ON Orbedata.dbo.transactions.item = M1_KF.dbo.PartUnitSalePrices.imhPartID WHERE tdate>=DATEADD(wk,DATEDIFF(wk,0,GETDATE()),0) and tdate<=DATEADD(wk,DATEDIFF(wk,0,GETDATE()),6) AND trans = 'fpr' GROUP BY DATEADD(dd, 0, DATEDIFF(dd, 0, tdate)) ,ISNULL(trans, 'NON') ,ISNULL(Transactions.item, Snumbers.item) ,tuser ,Orbedata.dbo.transactions.qty order by tuser,item "; $result =odbc_exec($connect,$sql); if(!$result){ exit("Error in SQL"); } while (odbc_fetch_row($result)) { $scanner=odbc_result($result,"tuser"); $Item=odbc_result($result,"item"); $Qty=odbc_result($result,"qty"); $Price=odbc_result($result,"TotalPrice"); $num = number_format($Price, 2); $grandTotal += $Price; $num2 = number_format( $grandTotal, 2); } odbc_close($connect); echo "$num2"; ?> </div> </body> </html>
  5. I am not sure how to dump the contents into a var something like this: <?php ob_start(); include 'bs_kf_production_price_week.php'; $weekprod= ob_get_contents(); echo "<p> $weekprod;| Weeks</p> "; ob_end_clean(); ?>
  6. I tried it like this but I get the same results <p><?php include 'bs_kf_production_price_week.php';?>| Weeks</p>
  7. the include returns a number 23,573.07 so I would like it to show " 23,573.07 | Week" but what I get is "23,753.07 | Week" <div class="cont"> <?php include 'bs_kf_production_price_week.php';echo "<p>| Week</p> "?> <br> <p><bold>$377</bold> | Pending</p> <br> <p><bold>$156</bold> | <bad>Denied</bad></p> <br> <p><img src="assets/img/up-small.png" alt=""> 12% Compared Last Month</p> </div>
  8. I am trying to connect to Microsoft SQL Server but I get Fatal error: Call to undefined function odbc_connect() in: connect =odbc_connect("kfm1","sa","removed"); if(!$connect) { exit("Connection Failed: " . $connect); } I can connect with tsql -S sqlserver -U xxxxxxxxx -P xxxxxxxxx and with osql -S kfm1 -U xxxxxxxxx -P xxxxxxxxx using the odbc.ini Below is the setup. Centos 6.8 Cpanel::Easy::Apache v3.32.13 rev9999 PHP 5.5.35 freetds v1.00.13 Freetds.conf looks like this [sqlserver] host = IP address removed port = 1433 tds version = 8.0 /*******************/ odbc.ini [kfm1] Driver=FreeTDS Servername=sqlserver Database =M1_KF TDS_Version = 8.0 /********************/ odbcinst.ini [FreeTDS] Description = FreeTDS unixODBC Driver Driver = /usr/lib64/libtdsodbc.so Setup = /usr/lib64/libtdsS.so CPTImeout= COReuse= FileUsag=1 Trace = Yes TraceFile = /tmp/sql.log ForceTrace = Yes /****************************************/
  9. I called and ask them what to use and they told me they where not sure I could connect to my sql server from there site.
  10. I need to connect to my MS SQL Server from my website that is hosted on register.com I use freetds on my local setup and it works fine but I understand that I can use that from register.com. So how do I create a connection?
  11. did away with the Array this fixed it. while (odbc_fetch_row($result)) { $orgid=odbc_result($result,"cmoOrganizationID"); $name=odbc_result($result,"cmoName"); $tot2013=odbc_result($result,"2013"); $tot2014=odbc_result($result,"2014"); $tot2015=odbc_result($result,"2015"); $tot2016=odbc_result($result,"2016"); echo "<tr><td>$orgid</td>"; echo "<td>$name</td>"; echo "<td>$tot2013</td>"; echo "<td>$tot2014</td>"; echo "<td>$tot2015</td>"; echo "<td>$tot2016</td>";
  12. Array ( [cmoOrganizationID] => 10001 [cmoName] => custname removed [2013] => [2014] => [2015] => [2016] => 20404.25 ) Array ( [cmoOrganizationID] => 10002 [cmoName] => custname removed [2013] => 4290.13 [2014] => [2015] => [2016] => 8768.67 ) Array ( [cmoOrganizationID] => 10005 [cmoName] => custname removed [2013] => 2499.68 [2014] => 5464.17 [2015] => 1431.86 [2016] => 4164.55 )
  13. { echo "<tr><td>" .$row['cmoOrganizationID'] ."</td>"; echo "<td>" .$row['cmoName'] ."</td>"; echo "<td>" .$row['year'] ."</td></tr>"; } Notice: Undefined index: year in customer_compare.php on line 124
  14. I get the below error and not sure what to look at to fix it. Notice: Undefined offset: 2013 in customer_compare.php on line 124 Notice: Undefined offset: 2014 in customer_compare.php on line 125 Notice: Undefined offset: 2015 incustomer_compare.php on line 126 Notice: Undefined offset: 2016 in customer_compare.php on line 127 <?php $begin=$_POST["begin"]; $end=$_POST["end"]; $connect =odbc_connect("Removed"); if(!$connect) { exit("Connection Failed: " . $connect); } $sql=" select * from (SELECT DISTINCT cmoOrganizationID ,cmoName ,ompOrderTotalBase ,DATEPART(yyyy,ompOrderDate) as year FROM m1_kf.dbo.SalesOrders LEFT outer JOIN m1_kf.dbo.Organizations ON cmoOrganizationID = ompCustomerOrganizationID LEFT outer JOIN m1_kf.dbo.Employees ON lmeEmployeeID = cmoAccountManagerEmployeeID WHERE ompClosed = - 1 and ( ompOrderDate >= '$begin' AND ompOrderDate <= '$end' ) OR ( ompOrderDate >= convert(char(11),DATEADD(yy, -1, '$begin'),101) AND ompOrderDate <= convert(char(11),DATEADD(yy, -1,'$end'),101) ) OR ( ompOrderDate >= convert(char(11),DATEADD(yy, -2, '$begin'),101) AND ompOrderDate <= convert(char(11),DATEADD(yy, -2, '$end'),101) ) OR ( ompOrderDate >= convert(char(11),DATEADD(yy, -3, '$begin'),101) AND ompOrderDate <= convert(char(11),DATEADD(yy, -3, '$end'),101) ) ) as src pivot ( sum(ompOrderTotalBase) for year in ([2013], [2014], [2015] , [2016]) ) piv order by cmoOrganizationID " ; $result =odbc_exec($connect,$sql); if(!$result){ exit("Error in SQL"); } echo "<table><tr>"; echo "<th>CustID</th>"; echo "<th>Customer</th>"; echo "<th>2013</th>"; echo "<th>2014</th>"; echo "<th>2015</th>"; echo "<th>2016</th>"; //**************************************************************** while ($row = odbc_fetch_array($result)) { echo "<tr><td>" .$row['cmoOrganizationID'] ."</td>"; echo "<td>" .$row['cmoName'] ."</td>"; echo "<td>" .$row['2013'] ."</td>"; echo "<td>" .$row['2014'] ."</td>"; echo "<td>" .$row['2015'] ."</td>"; echo "<td>" .$row['2016'] ."</td></tr>"; } ?>
  15. This solved it while ($row = odbc_fetch_array($result)) { echo "<tr><td>" .$row['ompShippingMethodID'] ."</td>"; echo "<td>" .$row['UOMPTRUCKNUMBER'] ."</td>"; echo "<td>" .$row['cmoName'] ."</td>"; echo "<td><a href='kf_order_by_id.php?id={$row['ompSalesOrderID']}'>" .$row['ompSalesOrderID'] ."</td>"; echo "<td>" . number_format($row['total'],2) ."</td></tr>"; $gr_total = $gr_total + $row['total']; if ($row['ompShippingMethodID'] == "CPU" ){ $cpu_total = $cpu_total + $row['total']; } else { $kith_total = $kith_total + $row['total']; } } //****************************************************************** odbc_close($connect); $num2 = number_format( $gr_total, 2); echo " Total: $num2"; echo " "; echo "$cpu_total"; echo " "; echo "$kith_total"; ?>
  16. after refresh this is the results http://s1064.photobucket.com/user/kat35601/media/Selection_054_zpsvvmmz03f.png.html
  17. still same results as before even after trimming string(3) "CPU" string(3) "CPU" string(3) "CPU" string(3) "CPU" string(3) "CPU" string(3) "CPU" string(3) "CPU" string(3) "CPU" string(3) "CPU" string(3) "CPU" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH" string(4) "KITH"
  18. I see a space with CPU?? maybe. I tried it with a space but same results.
  19. output string(5) "CPU " string(5) "CPU " string(5) "CPU " string(5) "CPU " string(5) "CPU " string(5) "CPU " string(5) "CPU " string(5) "CPU " string(5) "CPU " string(5) "CPU " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH " string(5) "KITH "
  20. see the results here http://s1064.photobucket.com/user/kat35601/media/Selection_053_zps4utaxhfd.png.html
  21. The now is <?php $gr_total = 0; $cpu_total = 0; $kith_total = 0; $output = ''; while ($row = odbc_fetch_array($result)) { //Update totals $row_total = number_format($row['total'], 2); $gr_total = $gr_total + $row_total; if ($row['ompShippingMethodID'] == "CPU" ){ $cpu_total = $cpu_total + $row_total; } else { $kith_total = $kith_total + $row_total; } //Create output $output .= "<tr>\n"; $output .= "<td>{$row['ompShippingMethodID']}</td>\n"; $output .= "<td>{$row['UOMPTRUCKNUMBER']}</td>\n"; $output .= "<td>{$row['cmoName']}</td>\n"; $output .= "<td><a href='kf_order_by_id.php?id={$row['ompSalesOrderID']}'>{$row['ompSalesOrderID']}</td>\n"; $output .= "<td>{$row_total}</td>\n"; $output .= "<td>{$cpu_total}</td>\n"; $output .= "<td>{$kith_total}</td>\n"; $output .= "<td>{$gr_total}</td>\n"; $output .= "</tr>\n"; } ?> <table border="1"> <tr> <th>Shipping Method</th> <th>TRUCK NUMBER</th> <th>cmo Name</th> <th>Order ID</th> <th>Row Total</th> <th>CPU Total</th> <th>Kith Total</th> <th>Grand Total</th> </tr> <?php echo $output; ?> </table>
  22. Cpu totals does not show up at all and the totals are way off. I don't know what to try next.
  23. Sorry let me try to explain better: " need to sum the total field if 'ompShippingMethodID' == "CPU" then thats one number" the total field is a number and that is what I want to add up for ever row of data that has ompShippingMethodID' == "CPU" and then add everything else up for my second number.
  24. I need to sum the total field if 'ompShippingMethodID' == "CPU" then thats one number and then total everything else. I know my code is wrong but I did it so you could see what I was after. while ($row = odbc_fetch_array($result)) { echo "<tr><td>" .$row['ompShippingMethodID'] ."</td>"; echo "<td>" .$row['UOMPTRUCKNUMBER'] ."</td>"; echo "<td>" .$row['cmoName'] ."</td>"; echo "<td><a href='kf_order_by_id.php?id={$row['ompSalesOrderID']}'>" .$row['ompSalesOrderID'] ."</td>"; echo "<td>" . number_format($row['total'],2) ."</td></tr>"; $gr_total = $gr_total + $row['total']; if ('ompShippingMethodID' == "CPU" ){ $cpu_total=$cpu_total + $row['total']; } else { $kith_total=$kith_total + $row['total']; } }
  25. Sure this is the code for information I would like to send. I wanted to use an include because I thought it would be easier to change in the future. <!DOCTYPE html> <html lang="en"> <head> <title>DashBoard</title> </head> <body> <?php $grandTotal = 0; $connect =odbc_connect("removed"); if(!$connect) { exit("Connection Failed: " . $connect); } $sql="select case when rtrim(so.uompfurnhold) in ('0','1','') then 'Released' when rtrim(so.uompfurnhold) ='2' then 'Product' when rtrim(so.uompfurnhold) ='3' then 'Minimal' when rtrim(so.uompfurnhold) ='4' then 'Customer' else 'GO' end as OrdStatus, count(SO.ompSalesOrderID) as orders,round(sum(SO.ompOrderSubTotalBase),2) as total FROM m1_kf.dbo.SalesOrders SO Where so.ompClosed !=-1 Group by case when rtrim(so.uompfurnhold) in ('0','1','') then 'Released' when rtrim(so.uompfurnhold) ='2' then 'Product' when rtrim(so.uompfurnhold) ='3' then 'Minimal' when rtrim(so.uompfurnhold) ='4' then 'Customer' else 'GO' end "; $result =odbc_exec($connect,$sql); if(!$result){ exit("Error in SQL"); } #echo "SalesPerson Total". date("m-d-Y") ; echo "<table><tr>"; echo "<th>Status</th>"; echo "<th> </th>"; echo "<th>Orders</th>"; echo "<th> </th>"; echo "<th>Total</th></tr>"; while (odbc_fetch_row($result)) { $OrdStatus=odbc_result($result,"OrdStatus"); $orders=odbc_result($result,"orders"); $total=odbc_result($result,"total"); $num = number_format($total, 2, '.', ','); $grandTotal += $total; echo "<tr><td>$OrdStatus</td>"; echo "<td> ◃ </td>"; echo "<td align='center' >$orders</td>"; echo "<td> ▹ </td>"; echo "<td>$num</td>"; # echo "<td align='right'>$num</td></tr>"; } #$num2 = number_format( $grandTotal, 2); #echo "Grand Total: $num2"; odbc_close($connect); ?> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.