📄 invoice.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using Sybase.DataWindow;
using SPRFrame;
namespace HPIResource.ShouFei
{
public class Invoice : DataStore
{
string strSQl = "";
public Invoice()
{
this.LibraryList = HPIR.PbdFile;
this.DataWindowObject = "dw_invoice";
this.SetTransaction(SPRF.GetDB());
strSQl = this.GetSqlSelect();
}
public Invoice(string sType)
{
this.LibraryList = HPIR.PbdFile;
this.DataWindowObject = "dw_invoice_"+sType;
this.SetTransaction(SPRF.GetDB());
strSQl = this.GetSqlSelect();
}
public void ResetSQL()
{
this.SetSqlSelect(strSQl);
}
#region 属性
public int ID
{// 内部编号
get
{
if (this.RowCount == 0) return -1;
return Convert.ToInt32(this.GetItemDouble(this.CurrentRow, "id"));
}
set
{
if (this.RowCount == 0) return;
this.SetItemDouble(this.CurrentRow, "id", value);
}
}
public string InvNo
{// 发票号码
get
{
if (this.RowCount == 0) return "NoData";
return this.GetItemString(this.CurrentRow, "InvNo");
}
set
{
if (this.RowCount == 0) return ;
this.SetItemString(this.CurrentRow, "InvNo", value);
}
}
public string InvType
{// M 门诊发票 Z 住院发票
get
{
if (this.RowCount == 0) return "NoData";
return this.GetItemString(this.CurrentRow, "InvType");
}
set
{
if (this.RowCount == 0) return;
this.SetItemString(this.CurrentRow, "InvType", value);
}
}
public string STS_ZF
{// 作废标志 T 作废 F 未作废
get
{
if (this.RowCount == 0) return "NoData";
return this.GetItemString(this.CurrentRow, "STS_ZF");
}
set
{
if (this.RowCount == 0) return ;
this.SetItemString(this.CurrentRow, "STS_ZF", value);
}
}
public string TransNo
{// 保险交易号
get
{
if (this.RowCount == 0) return "NoData";
return this.GetItemString(this.CurrentRow, "TransNo");
}
set
{
if (this.RowCount == 0) return ;
this.SetItemString(this.CurrentRow, "TransNo", value);
}
}
public int AccID
{// 内部结算编号
get
{
if (this.RowCount == 0) return -1;
return Convert.ToInt32(this.GetItemDouble(this.CurrentRow, "AccID"));
}
set
{
if (this.RowCount == 0) return;
this.SetItemDouble(this.CurrentRow, "AccID", value);
}
}
public int ActDate
{// 发生日期
get
{
if (this.RowCount == 0) return -1;
return Convert.ToInt32(this.GetItemDouble(this.CurrentRow, "ActDate"));
}
set
{
if (this.RowCount == 0) return;
this.SetItemDouble(this.CurrentRow, "ActDate", value);
}
}
public int ActTime
{// 发生时间
get
{
if (this.RowCount == 0) return -1;
return Convert.ToInt32(this.GetItemDouble(this.CurrentRow, "ActTime"));
}
set
{
if (this.RowCount == 0) return;
this.SetItemDouble(this.CurrentRow, "ActTime", value);
}
}
public int ActMan
{// 收款人
get
{
if (this.RowCount == 0) return -1;
return Convert.ToInt32(this.GetItemDouble(this.CurrentRow, "ActMan"));
}
set
{
if (this.RowCount == 0) return;
this.SetItemDouble(this.CurrentRow, "ActMan", value);
}
}
public string PayerID
{// 付款人编号
get
{
if (this.RowCount == 0) return "NoData";
return this.GetItemString(this.CurrentRow, "PayerID");
}
set
{
if (this.RowCount == 0) return ;
this.SetItemString(this.CurrentRow, "PayerID", value);
}
}
public string PayerName
{// 付款人姓名
get
{
if (this.RowCount == 0) return "NoData";
return this.GetItemString(this.CurrentRow, "PayerName");
}
set
{
if (this.RowCount == 0) return ;
this.SetItemString(this.CurrentRow, "PayerName", value);
}
}
public double SUM_YS
{// 应收金额
get
{
if (this.RowCount == 0) return 0;
try
{
return this.GetItemDouble(this.CurrentRow, "SUM_YS");
}
catch
{
return 0;
}
}
set
{
if (this.RowCount == 0) return;
this.SetItemDouble(this.CurrentRow, "SUM_YS", value);
}
}
public double SUM_ML
{// 抹零金额
get
{
if (this.RowCount == 0) return 0;
try
{
return this.GetItemDouble(this.CurrentRow, "SUM_ML");
}
catch
{
return 0;
}
}
set
{
if (this.RowCount == 0) return;
this.SetItemDouble(this.CurrentRow, "SUM_ML", value);
}
}
public double SUM_SL
{// 实收金额
get
{
if (this.RowCount == 0) return 0;
try
{
return this.GetItemDouble(this.CurrentRow, "SUM_SL");
}
catch
{
return 0;
}
}
set
{
if (this.RowCount == 0) return;
this.SetItemDouble(this.CurrentRow, "SUM_SL", value);
}
}
public double SUM_JZ
{// 记帐金额(保险等)
get
{
if (this.RowCount == 0) return 0;
try
{
return this.GetItemDouble(this.CurrentRow, "SUM_JZ");
}
catch
{
return 0;
}
}
set
{
if (this.RowCount == 0) return;
this.SetItemDouble(this.CurrentRow, "SUM_JZ", value);
}
}
#endregion
#region 取数据的方法
public void SetDataById(int ID)
{
this.ResetSQL();
string s = this.GetSqlSelect();
int i = s.IndexOf("WHERE");
if (i > 0)
{
string s1 = s.Substring(0, i + 5);
string s2 = s.Substring(i + 6, s.Length - i - 6);
s = s1 + " ( id = " + ID.ToString() + ") and " + s2;
}
else
{
s += " where id = " + ID.ToString();
}
this.SetSqlSelect(s);
}
public void SetDataByInvNo(string InvNo, string invType)
{
this.ResetSQL();
string SqlString = this.GetSqlSelect();
SqlString += "where InvNo ='" + InvNo + "' and InvType = '" + invType.ToString() + "' order by ID";
this.SetSqlSelect(SqlString);
}
public void SetDataByInvNo(string InvNo)
{
this.ResetSQL();
string SqlString = this.GetSqlSelect();
SqlString += "where InvNo ='" + InvNo + "'order by ID";
this.SetSqlSelect(SqlString);
}
public void SetDataByPatID(string sPatID)
{
string s = this.GetSqlSelect();
int i = s.IndexOf("WHERE");
if (i > 0)
{
string s1 = s.Substring(0, i + 5);
string s2 = s.Substring(i + 6, s.Length - i - 6);
s = s1 + " ( payerid = '" + sPatID + "') and " + s2;
}
else
{
s += " where payerid = '" + sPatID+"'";
}
this.SetSqlSelect(s);
}
public void SetDataByInvType(string invType)
{
string s = this.GetSqlSelect();
int i = s.IndexOf("WHERE");
if (i > 0)
{
string s1 = s.Substring(0, i + 5);
string s2 = s.Substring(i + 6, s.Length - i - 6);
s = s1 + " ( invtype = '" + invType + "') and " + s2;
}
else
{
s += " where invtype = '" + InvType + "'";
}
this.SetSqlSelect(s);
}
public void SetDataByZF_STS(string zf_STS)
{
string s = this.GetSqlSelect();
int i = s.IndexOf("WHERE");
if (i > 0)
{
string s1 = s.Substring(0, i + 5);
string s2 = s.Substring(i + 6, s.Length - i - 6);
s = s1 + " ( sts_zf = '" + zf_STS + "') and " + s2;
}
else
{
s += " where sts_zf = '" + zf_STS + "'";
}
this.SetSqlSelect(s);
}
#endregion
#region 数据修改方法
public string AddData(int ID,string InvNo,string InvType,string STS_ZF,string TransNo,int AccID,int ActDate,int ActTime,
int ActMan,string PayerID,string PayerName,int SUM_YS,int SUM_ML,int SUM_SL,int SUM_JZ)
{//增加一条记录
int i = this.InsertRow(0);
this.SetRow(i);
this.SetItemDouble(i,"ID",ID);
this.SetItemString(i,"InvNo",InvNo);
this.SetItemString(i,"InvType",InvType);
this.SetItemString(i, "STS_ZF", STS_ZF);
this.SetItemString(i, "TransNo", TransNo);
this.SetItemDouble(i, "AccID", AccID);
this.SetItemDouble(i, "ActDate", ActDate);
this.SetItemDouble(i, "ActTime", ActTime);
this.SetItemDouble(i, "ActMan", ActMan);
this.SetItemString(i, "PayerID", PayerID);
this.SetItemString(i, "PayerName", PayerName);
this.SetItemDouble(i, "SUM_YS", SUM_YS);
this.SetItemDouble(i, "SUM_ML", SUM_ML);
this.SetItemDouble(i,"SUM_SL",SUM_SL);
this.SetItemDouble(i, "SUM_JZ", SUM_JZ);
try
{
this.UpdateData();
SPRFrame.SPRF.SQLCA.Commit();
return "成功";
}
catch (DbErrorException ee)
{
SPRF.ErrText = ee.SqlErrorText;
SPRF.SQLCA.Rollback();
return SPRF.ErrText;
}
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -