本文介绍了如何以ddmmyyhhmmss格式生成发票编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以ddmmyyhhmmss格式生成发票编号
how to generate the Invoice number in the format of ddmmyyhhmmss
推荐答案
string value = DateTime.Now.ToString("ddMMyyhhmmss");
刚刚注意到 - 你说发票号码?
通常有关于发票编号的规则,因为它们必须是连续的(以便税务局可以确保没有任何遗漏) - 这不会那样做,并且会结果可能是一个坏主意。
Just noticed - you said "invoice number"?
There are normally rules about invoice numbers, in that they must be sequential (so that the Tax office can be sure that there aren't any missing) - this does not do that, and would probably be a bad idea as a result.
ddMMyyhhmmss
dd-两位数d吃了
MM-两位数月份
yy-两位数年份
hh - ditis小时
mm-数字分钟
ss-seconds in digis。
dd-two digit date
MM-two digit month
yy-two digit year
hh - hours in ditis
mm- minutes in digits
ss-seconds in digis.
int ctr, len;
string code;
DataRow drr;
string qry = "select top 1 id from client_bill_Tb order by id desc";
DataTable dt = cbbal.GetData(qry);
len = dt.Rows.Count - 1;
drr = dt.Rows[len];
code = drr["id"].ToString();
ctr = Convert.ToInt32(code);
if ((ctr >= 0) && (ctr < 9))
{
ctr = ctr + 1;
txtInvoice.Text = ctr + DateTime.Now.ToString("/MMyyyy");
}
else if ((ctr >= 9) && (ctr < 100))
{
ctr = ctr + 1;
txtInvoice.Text = ctr + DateTime.Now.ToString("/MMyyyy");
}
else if (ctr >= 99)
{
ctr = ctr + 1;
txtInvoice.Text = ctr + DateTime.Now.ToString("/MMyyyy");
}
我希望你对你有用...
I hope u its useful for u...
这篇关于如何以ddmmyyhhmmss格式生成发票编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!