10-27-2016, 02:05 AM,
|
|
swaminathan
Member
|
Posts: 23
Threads: 6
Joined: Sep 2016
|
|
Insert Row numbers in Invoice
How to Insert Row numbers in Invoice
I want to insert row numbers in invoice, as Sr.No for each item in invoice
I have tried to use salesorderdetails.orderlineno this suits my requirement, but he problem is -
When i insert the line -salesorderdetails.orderlineno in the SQL Query
// gather the invoice data
if($InvOrCredit=='Invoice') {
$sql = "SELECT debtortrans.trandate,
debtortrans.ovamount,
salesorderdetails.orderlineno
I get an SQL error saying unknown column in field list.
I tried -
$orderno = $myrow[orderno];
$result = DB_query("SELECT orderlineno
FROM salesorderdetails
WHERE orderno = " . $orderno );
$linecount = DB_fetch_array($result);
$orderlines = $Itemcount['orderlineno'];
this returns only one row from the salesorder I have four items in the order selected.
Result with echo statement- echo print_r( $linecount);
shows- Array ( [0] => 0 [orderlineno] => 0 )
how do I fetch all lines in order.
Please help
Thanks
Swaminathan
|
|
10-28-2016, 01:05 AM,
(This post was last modified: 10-28-2016, 01:08 AM by swaminathan.)
|
|
swaminathan
Member
|
Posts: 23
Threads: 6
Joined: Sep 2016
|
|
RE: Insert Row numbers in Invoice
thanks
tried the following code-
$orderno = $myrow['orderno'];
$result=DB_query("SELECT salesorderdetails.orderlineno FROM salesorderdetails
INNER JOIN debtortrans
ON debtortrans.order_ = salesorderdetails.orderno
Where salesorderdetails.orderno =" .$orderno);
$myrow3 = DB_fetch_array($result);
$Orderlineno = $myrow3 ['orderlineno'] ;
echo print_r($Orderlineno) ;
But only one row fetched out of four in the invoice.
the same code fetches all the rows when run in PHPMyAdmin.
Thanks
Swaminathan
|
|
10-29-2016, 02:00 AM,
(This post was last modified: 10-29-2016, 02:02 AM by swaminathan.)
|
|
swaminathan
Member
|
Posts: 23
Threads: 6
Joined: Sep 2016
|
|
RE: Insert Row numbers in Invoice
Thanks
This works, but I now get only the last row number on all rows on the invoice table.
I have shifted the item code column to right and created space for the row number column
Thanks
Swaminathan
|
|
10-29-2016, 03:16 PM,
|
|
swaminathan
Member
|
Posts: 23
Threads: 6
Joined: Sep 2016
|
|
RE: Insert Row numbers in Invoice
This is my code-
$orderno = $myrow['orderno'];
$result=DB_query("SELECT salesorderdetails.orderlineno FROM salesorderdetails
INNER JOIN debtortrans
ON debtortrans.order_ = salesorderdetails.orderno
Where salesorderdetails.orderno =" .$orderno);
while ($myrow3 = DB_fetch_array($result)) {
$Orderlineno = $myrow3 ['orderlineno'];
}
here with echo print_r($myrow3);
I get- Array ( [0] => 0 [orderlineno] => 0 ) 1Array ( [0] => 1 [orderlineno] => 1 ) 1Array ( [0] => 2 [orderlineno] => 2 ) 1Array ( [0] => 3 [orderlineno] => 3 )
I have 4 rows in this invoice.
with echo print_r($orderlineno);
I get- 01112131
but with-
$LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,71,$FontSize,$Orderlineno);// Print Row number.
only last row number- 3 is displayed on the invoice for all four rows
I guess the code is not in appropriate location.
is there a way to share the pdf invoice and PrintCustTransPortrait.php Files .
Thanks
Swaminathan
|
|
10-30-2016, 02:49 PM,
|
|
swaminathan
Member
|
Posts: 23
Threads: 6
Joined: Sep 2016
|
|
RE: Insert Row numbers in Invoice
Tried this and now works fine
thank you
$RownumResult = DB_query("SELECT (orderlineno +1) AS srno
FROM salesorderdetails
INNER JOIN debtortrans
ON debtortrans.order_ = salesorderdetails.orderno
WHERE stkcode =" . $myrow2['stockid'] . "
AND salesorderdetails.orderno='" . $myrow['orderno'] . "'");
Thanks
Swaminathan
|
|
|