Preparing Balance sheet with PHPMaker

Tips submitted by PHPMaker users
Post Reply
innovativeshadow
User
Posts: 86
Location: Almaty, Kazakhstan

Preparing Balance sheet with PHPMaker

Post by innovativeshadow »

Hi all,

    I Know many of you were searching for how to make a balance sheet, I myself had searched for it and I finally got it working.

    Here is the description an code:

Notes:
You can prepare it using "custom view" only, I don't know the reason it was not working with "View".

First I created a tabel name "dailycashreport" with fields ID(Auto Increment), Date, Remarks, Category, SubCategory, Credit, Debit

First I dont understand much about how it is working, if any experts chose to explain, that will be good.
in the formula there was a string called @rt which was giving error in view but working in custom view.

================
SELECT dailycashreport.ID AS ID,
dailycashreport.Date AS Date,
dailycashreport.Remarks AS Remarks,
dailycashreport.Category AS Category,
dailycashreport.SubCategory AS SubCategory,
Concat(Format(dailycashreport.Credit, 2), ' KZT') AS Credit,
Concat(Format(dailycashreport.Debit, 2), ' KZT') AS Debit,
Concat(Format((@rt := @rt + Coalesce(dailycashreport.Credit, 0) -
Coalesce(dailycashreport.Debit, 0)), 2), ' KZT') AS Balance
FROM dailycashreport,
(SELECT @rt := 0) rt
ORDER BY Date,
ID

================

I hope this helps someone and also some experts can explain how it is works.
Please do comment your review and any ideas are also appreciated.

I used this table to get records as i insert data in another table, so i used 1 more field in my original table called it M_ID, so it can be used for update and delete of record here when i update the another table record.


innovativeshadow
User
Posts: 86
Location: Almaty, Kazakhstan

Post by innovativeshadow »

An Update on this,

@rt (@RowTo) means "row to" variable
@rf (@RowFrom) means "row from" variable

this should explain the query used till some extinct.


aniederer
User
Posts: 5

Post by aniederer »

I wanted to thank first for sharing the balance query, very good alternative.

From what I have seen they all use variables and can not be created as views.

In the post they indicate that you can not create a view but a custom view.

I have tried creating a custom view with balance and it works very well.

Thanks for the input


Post Reply