0

Sir I have these 2 tables (Arrival+Pouring) shown in Attachment

I create result table with this query

select c1.date,sum(nvl(cx.purchase-cx.sold,0))  as opening,c1.purchase,c1.sold,;
        sum(nvl(cx.purchase-cx.sold,0)) + c1.purchase-c1.sold as closing ;
    from ;
        (select NVL(a.date,b.date) as date,CAST(NVL(a.qty,0) as integer) as purchase,;
        CAST(NVL(b.qty,0) as integer) as sold from purchase a FULL JOIN sold b ON a.date = b.date order by 1) c1 ;
    left join;
     (select NVL(a.date,b.date) as date,CAST(NVL(a.qty,0) as integer) as purchase,;
     CAST(NVL(b.qty,0) as integer) as sold from purchase a FULL JOIN sold b ON a.date = b.date order by 1) cx ;
    on c1.date>cx.date;
     group by c1.date,c1.purchase,c1.sold

The query work fine to get opening and closing balance.
But I want to use PHP Codes like array and echo etc to show result.

Please help me to convert the query into php codes.

Thanks

Edited by phphp

Attachments t.png 81.98 KB
2
Contributors
3
Replies
25
Views
1 Year
Discussion Span
Last Post by rproffitt
0

You may also have to reveal if the output in your picture was the result of some Word document, HTML, LaTex or other system.
Complete your "specification" since PHP output can be text or other depending on your php foo.

Edited by rproffitt: Grammer

0

Sir, I prepared an Excel Sheet for result. I enter accuarate result to show you what out put i need.

acutally I need this type of codes

$close=0;
$loop=0;

while($row=mysqli_fetch_assoc($res))
{
echo "<table><tr><td>Date</td><td>Opening</td><td>Purchase</td><td>Sold</td><td>Closing</td></tr>";
echo $stock[$loop]["date"]=$row["date"];
$stock[$loop]["close"]=$row["arrqty"]-$row["pourqty"];
$stock[$loop]["arrqty"]=$row["arrqty"];
$stock[$loop]["pouqty"]=$row["pourqty"];
$stock[$loop]["open"]=$close;
$close=$row["arrqty"]-$row["pourqty"];
$loop++;
}
echo "</table>"
0

I think you want a HTML result so next time be sure to reveal that in your post or spec. You used Excel so that's fine but PHP to Excel files is a whole ball game.

What's up with your current PHP code? Since I can't put it into some PHP fiddle I can't check it for you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.