Results 1 to 2 of 2

Thread: culculate

  1. #1
    Join Date
    Apr 2007
    Location
    kuantan
    Posts
    2
    Rep Power
    0

    Question culculate

    can u help.....give me....coding untuk kira debit - credit,

    //ini credit_list akan ditambah dengan debit_in
    $sqlstmt=mysql_query("SELECT SUM(credit_list) AS JUM FROM sbsv_exp WHERE acc_code = 'CF' AND Monthname(date_chq)-1='$month' AND Year(date_chq)= '$year'");
    $result=mysql_fetch_array($sqlstmt);
    $credit_list=$result['JUM'];
    echo $credit_list;

    $sqlstmt=mysql_query("SELECT SUM(debit_in) AS JUM FROM cash_in WHERE Monthname(date_in)-1='$month' AND Year(date_in)= '$year'");
    $result=mysql_fetch_array($sqlstmt);
    $debit_in=$result['JUM'];
    echo $debit_in;

    $sqlstmt=mysql_query("SELECT SUM(amount_out) AS JUM FROM account WHERE Monthname(date_receipt)-1='$month' AND Year(date_receipt)= '$year'");
    $result=mysql_fetch_array($sqlstmt);
    $credit_account=$result['JUM'];
    echo $credit_account;

    echo $nilai = $credit_list + $debit_in;
    echo $nilai1 = $nilai - $credit_account;


    *bagaimana sy nak bawa $nilai1 ke bulan seterusnye.....bile saya pilih bulan february akan displaykan balance($nilai1)january tanpa balance disimpan dalam database........SELECT SUM gabungkan 2 table....table debit dan table cerdit....

    please....

  2. #2
    Join Date
    Aug 2006
    Location
    Malaysia
    Posts
    1,576
    Rep Power
    188
    Without saving the remainder - $nilai1 into the additional table, the account table has to be updated by specifying the month and year.

    The rough concept:
    - $Account = RM100 in Jan 2007
    - $Debit - Buying RM10 in Jan 2007
    - $Credit - Cash in RM20 in Jan 2007
    - Deduct $100 from the Account
    => $Account - $Credit + $Credit = RM110
    => RM100 - RM10 + RM20 = RM110

    Update the account amount and its month and year.
    - Account = RM110 in Feb 2007

    You need to think about/assess it whether it is suitable to your business logic/flow.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39