如何跟踪每月付款 [英] How to keep track of montly payments

查看:96
本文介绍了如何跟踪每月付款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在忙于网站,但我不知道如何跟踪我每月收到的付款.我最难的问题是数据库结构如何.现在,我并不是真的在寻找代码,我只需要有人点亮我的灯泡即可.您的帮助将不胜感激.

Hi,
I''m busy with a website and I don''t know how to keep track payments that I receive montly. My hardest problem is how my database structure would be. Right now I''m not really looking for code I just need someone to light up my bulb. Your help would be appreciated.

推荐答案

您只需存储每次付款的日期;我知道的大多数数据库都可以让您计算日期的不同部分.如果您的数据库支持计算列,则可以让它计算插入/更新的月份部分,从而可以方便地访问数据.
You simply need to store the date for each payment; most databases that I''m aware of allow you to calculate the different parts of a date. If your database supports calculated columns, you could have it compute the month part on insert/update and it would give you convenient access to the data.


只需要扩展Pete的正确性即可.答案,

创建一个付款表,确保您存储PaymentDate和PaymentValue字段以及您需要的其他内容(付款人,付款方式,简短说明等)

像(SQL Server语法)之类的东西

Just to expand on Pete''s correct answer,

Create a payments table, make sure you store the PaymentDate and PaymentValue fields + whatever else you require (who made the payment, payment source, short description etc)

Something like (SQL Server Syntax)

CREATE TABLE [Payments] (
    [Id] [int] IDENTITY (1, 1) NOT NULL ,
    [PaymentDate] [datetime] NULL ,
    [PaymentValue] [money] NULL ,
    [Description] [varchar] (50),
    [PaidBy] [varchar] (50)
    CONSTRAINT [PK_Payments] PRIMARY KEY  CLUSTERED
    (
        [Id]
    ) WITH  FILLFACTOR = 90  ON [PRIMARY]
) ON [PRIMARY]
GO



这将包含您收到的单笔付款.然后,您可以编写查询来按月汇总数据



This will contain individual payments you receive. You can then write a query that summarises data by month


添加GETDATE()作为PaymentDate的默认值,如果为空
Add the GETDATE() as a default value for PaymentDate instead if NULL


这篇关于如何跟踪每月付款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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