序言
現如今存在的財務軟件層出不窮,怎么樣讓自己的業務系統與財務系統相結合,往往是很多公司頭痛的問題。大多數公司也沒有這個能力都去開發一套屬於自己的財務軟件,所以只有對接像金蝶用友這類的財務軟件,花費大量的人力物力在兩套系統中切換,從而開發屬於自己的一套業務和財務一體化的系統迫在眉睫,去解決這些痛點。
如何去實現winform憑證
用C#語言開發,CS框架,DevExpress控件,實現出來的效果如下:

會計科目支持代碼、科目和助記碼的模糊搜索,可以進行快速找到相應的科目。同金蝶和用友專業的財務軟件媲美了,功能齊全,操作方便簡單。

錄入憑證之前先對科目進行定義,科目都是財政部相對應的科目:


錄入簡單的憑證,進行測試,相對簡單方便。

保存完進行打印,打印出來就是專業的會計憑證了,憑證的打印是用時銳浪進行實現的。同時支持A4紙張和套打都可以。
try
{
string ReportPath = "", printtitle = "", printername = "";
float paperlength = 0, paperwidth = 0;
string printModel = CommonArgs.printTypes.ContainsKey(printType) ? (printType == "托運單" ? "tydtype" : printType == "標簽" ? "bqtype" : (CommonArgs.printTypes[printType] + "Model")) : "";
printtitle = API.ReadINI("Print", printModel, "", CommonArgs.config);
printtitle = printtitle == "" ? printType : printtitle;//如果是沒有選擇模板的,默認為打印類型,找一下配置
//查找配置信息
DataRow[] drs = CommonClass.DsPrint.Tables[0].Select("title='" + printtitle + "'");
if (drs.Length > 0)
{
paperlength = drs[0]["paperlength"].ToFloat();
paperwidth = drs[0]["paperwidth"].ToFloat();
ReportPath = drs[0]["grfname"].ToStringEx();
}
else
{
ReportPath = printType + ".grf";
}
string reportpath = Application.StartupPath + "\\" + ReportPath;
if (!System.IO.File.Exists(reportpath))
{
XtraMessageBox.Show("缺少相應的打印模板文件【" + ReportPath + "】!", "系統提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
printername = GetPrinter(printType);
if (printername == "" || !CommonClass.CheckPrinters(printername))
{
PrintDocument prtdoc = new PrintDocument();
printername = prtdoc.PrinterSettings.PrinterName;//獲取默認的打印機名
ShowPrintDialog = true;
}
Report.LoadFromFile(reportpath);
ds = new DataSet();
ds.Tables.Add(dt.Copy());
if (paperlength != 0)
{
Report.Printer.PaperLength = paperlength;
Report.Printer.PaperWidth = paperwidth;
Report.Printer.PaperSize = 256;
Report.Printer.SheetPages = GRSheetPages.grsp1Pages;
}
Report.Printer.PrinterName = printername;
Report.LoadDataFromXML(ds.GetXml());
Report.Print(ShowPrintDialog);
if (ShowPrintDialog) saveprinter(printType, Report.Printer.PrinterName);
//保存打印次數
CommonClass.SetPrintCount(printType, dt);
}
catch (Exception ex)
{
XtraMessageBox.Show(ex.Message, "系統提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
銳浪設計文件如下,把相應的字段對應基本上就大功告成了。

如何用代碼去實現憑證界面的開發
其實說到用代碼去實現憑證這個界面的開發還是挺有難度的,CS不必BS那么容易去布局,這個界面實現起來沒得幾千行代碼也是搞不定,難點還是在借方和貸方金額這里,整個界面下面是一張背景圖。
保存好的憑證,並可以打開查看業務明細:

結束語
以上就是財務憑證的實現,有興趣朋友一起研究學習進步。
可加QQ群:186841119
程序下載地址:https://download.csdn.net/download/lxc442389681/16741582
