CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Ledger Running Balance

Print topic Send  topic

Author Message
idh63

Posts: 76
Posted: 01/20/2008, 9:36 AM

Hi Folks,

I havent been using CCS for about 18 months.

I have been using Zend Studio to test the work of hired programmers and the debugging features have really helped me learn a lot more about PHP.

Anyway, I have been having a frustrating time creating a ledger report with a Credits | Debits | Running Total.

The name of the page is account_details

Having read the logic in account_details.php I see exactly where i could customize the code so I have the running balance displayed in the r_balance field in the row.

$is_next_record = $this->DataSource->next_record();
$this->IsEmpty = ! $is_next_record;
while($is_next_record) {
$this->DataSource->SetValues();
$this->ex_date->SetValue($this->DataSource->ex_date->GetValue());
$this->ttype->SetValue($this->DataSource->ttype->GetValue());
$this->status->SetValue($this->DataSource->status->GetValue());
$this->deposit->SetValue($this->DataSource->deposit->GetValue());
$this->withdraw->SetValue($this->DataSource->withdraw->GetValue());
$this->r_balance->SetValue($this->DataSource->r_balance->GetValue());
$this->req_date->SetValue($this->DataSource->req_date->GetValue());
$this->TotalSum_deposit->SetValue($this->DataSource->TotalSum_deposit->GetValue());
$this->TotalSum_withdraw->SetValue($this->DataSource->TotalSum_withdraw->GetValue());
$this->Current_balance->SetValue("");
if (count($Groups->Groups) == 0) $Groups->OpenGroup("Report");
$Groups->AddItem();
$is_next_record = $this->DataSource->next_record();
}

Plus of course creating additional logic for adding to the $r_balance on each iteration.

So my question is, How the heck do you do this without customizing account_details.php?

There does not seem to be a way to add and update a variable within the associated account_details_events.php that would process within this loop.

I know i must be missing something? Help!

Thanks

David
View profile  Send private message
idh63

Posts: 76
Posted: 01/20/2008, 10:08 AM

Just to add...I was originally going to achieve my results with the following mysql query which works fine outside of CCS, but unfortunately mySql ODBC 3.51 rejects sql variables.

SET @bal =0;  
SELECT  
transaction_type.`type`,  
transaction_status.tstatus,  
transaction.deposit,  
transaction.withdraw,  
transaction.req_date,  
transaction.ex_date, @bal := @bal + (transaction.deposit - transaction.withdraw) as running_balance  
FROM  
transaction  
Inner Join transaction_status ON transaction.`status` = transaction_status.tstatus_id  
Inner Join transaction_type ON transaction.ttype = transaction_type.ttype_id  
ORDER BY ex_date;
View profile  Send private message
idh63

Posts: 76
Posted: 01/20/2008, 11:59 AM

ok I found a solution that works.

1. Add the debit and credit row values to a new column in mysql (say r_balance).

2. set the control source of the label to the name of the new mysql column.

3. Use the Sum function available in the labels properties.

Is it really this easy?
View profile  Send private message
datadoit
Posted: 01/20/2008, 5:21 PM

idh63 wrote:
>
> Is it really this easy?
> ---------------------------------------

Don't tell anyone in human resources!

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.