开盘和平仓 [英] Opening and Closing Balance

查看:112
本文介绍了开盘和平仓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的团队,



寻求帮助,了解编写代码的逻辑,以获得期末余额。我在库存系统上练习,每天都会有一个账户来存入和取出。存款和取款部分由我开发,我无法写的是期末余额逻辑。



每当用户登录并检查期末余额时,他应该可以拥有它。

可以在这方面提供帮助



raj

解决方案

亲爱的rajeshsinh,



您应该维护一个交易表。它应该保留所有交易,包括期初余额。通常交易应该包含转账,日期,金额,账户。



如果是借方你可以给出+ ve的金额和你可以给的贷方金额-ve值。要获得余额,您可以选择该帐户的金额字段总和。该列将是帐户的余额。



你可以这样做:



选择总和(金额)来自acctran的余额,其中acode ='1234'和docdate> ='01 / apr / 2013'和docdate< ='08 / sep / 2013';



余额栏将是帐户余额。



如有问候,



Sunil

Dear Team,

Seek Help in understanding the logic of writing code for availing the closing balance. i m practising on inventory system where there will be an account maintained on daily basis for deposit and withdrawal. Deposit and withdrawal part have been developed by me, what i am unable to write is the closing balance logic.

Whenever user will log in and check the closing balance, he should be able to have it.
can anybody help in this regards

raj

解决方案

dear rajeshsinh,

You should maintain a table of transactions. It should keep all transactions including opening balances. Usually a transaction should contain tran id, date, amount, account.

If it is debit u can give the amount as +ve and for the credit amounts u can give -ve values. For getting the balance, you may select the sum of amount field for that account. That column will be the balance of the account.

you can do like this:

select sum(amount) as balance from acctran where acode='1234' and docdate>='01/apr/2013' and docdate<='08/sep/2013';

the balance column will be the account balance.

with regards,

Sunil


这篇关于开盘和平仓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆