Click here to Skip to main content
14,239,876 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have 7 tables of COA as show in the picture attached. what I need is whenever opening balance goto - (negative) , the type must automatically show CR sign and whenever that account goto positive + , it must change to DR automatically. Please remember that the account will change to DR or CR as per entries . suppose I am doing entry in cash payment and if cash in hand account is Debit and utilities are CR in Chart of account. and if I pass an entry then and make utilities debit then in chart of accounts it must change from CR to DR in type column.

also my accountant do not want to see (-) sign with negative he need type should change as per entries

Let me explain more

suppose I have 2 accounts (cash in hand ) and ( Utility Bills )

the Opening balance of both accounts in Chart of Accounts is

Cash in Hand = 5000 DR

Utility Bills = 2000 CR

now if I do an entry in cash payment so it will be

utility bills (DR) = 8000

cash in hand (CR) = 8000

now after i do this entry the Chart of accounts must look like

Cash in hand = 3000 CR ( because it is in negative due to i had only 5000) (now here the balance must show like -3000) but instead of (-) it showing 3000 and DR change to CR

it must update in database as well

This is what I need to do

What I have tried:

i tried nothing but some logics that did not work at all
Updated 9-Jul-19 9:03am
Rate this:
Please Sign up or sign in to vote.

Solution 1

i tried nothing but some logics that did not work at all

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
Member 12654313 10-Jul-19 3:38am
my friend i can understand this but trust me i tried many things but fail thats why i thought to ask here any logic or any help let me explain more

my friend i have 5 accounting modules

cash payments

cash receipts

bank payments and receipts

journal entries

now all these modules are based on chart of accounts . in cash payment mostly cash in hand i credit and the account to whom we pay is debit .

now in chart of accounts cash in hand type or nature remains DR but other account to whom we pay cash is credit and if we pay him and his account type is DR in chart of account, then his account must show CR after we do entry in cash payment. and same like if we do entry in cash receipt, then his account will be DR if in chart of account its CR, becz we are receiving payment from him.

now i am not able to change the type of status from DR to CR or CR to DR after every transactions .
OriginalGriff 10-Jul-19 3:54am
That's because you don't. Database entries should be numbers - DECIMAL probably - and numbers don't have "a format" in a DB or computer any more than they do in the real world. What format could you apply to 5, or 666, or 17.995, or 3.1415927? Numbers are just that: numeric values that only have relevance when they are used. For example, dates and times aren't stored internally as 2019-07-10 08:46:12.8765 - they are stored as "N ticks since a predefined point in time". Which means we can do match with them: since a minutes in X ticks, we can subtract 10 minutes from a date time by subtracting 10 * X ticks from the number stored and it will work regardless of the date and time. Similarly, we can add 7 days by adding 7 *24 * 60 * X ticks and that will work as well.

Numbers have a sign (generally) positive (deposit or credit total) or negative (withdrawl or debit total) but that is only formatted as CR or DR, red or black, + or - when the information is presented to the user, and then it is presented in that specific user's prefered display, just as dates are presented in MM/dd/yyyy to an American, but dd/MM/yyyy to a European (or yyyy/MM/dd hh:mm:ss.ssss to an ISO user).

You don't mess about with formats in your DB: you present it in your presentation software in the users favourite style - which for most users is controlled by the regional settings for the computer, and the software being used, not the DB which will be used by several users.
Rate this:
Please Sign up or sign in to vote.

Solution 2

"DB" and "CR" are "presentation" details; just as "+" or "-" are.

You don't "change the database" because your "accountant" does / does not like "minus signs".

You "change the report" / display.

Because, next time, instead of "CR", they'll want to see "red"; or brackets.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100