using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
|
namespace BaseSet
|
{
|
public partial class Gy_DataIn_HouseNo2 :BLL.Gy_DataInTmp
|
{
|
public Gy_DataIn_HouseNo2()
|
{
|
InitializeComponent();
|
}
|
|
public int HRoomIDCol = 0; //Òµ»§ÄÚÂë
|
public int HBeginDateCol = 0; //¿ªÊ¼ÈÕÆÚ
|
public int HEndDateCol = 0; //½áÊøÈÕÆÚ
|
public int HItMoneyIDCol = 0; //·ÑÓÃÏîÄ¿
|
public int HQtyCol = 3; //ÊýÁ¿
|
public int HPriceCol = 0; //µ¥¼Û
|
public int HMoneyCol = 0; //½ð¶î
|
public int HBeginBalanceCol = 0; //¿ªÊ¼ÊýÖµ
|
public int HEndBalanceCol = 0; //½áÊøÊýÖµ
|
//
|
public const int HBeginRow = 4; //ÓÐЧÊý¾Ý£¬¿ªÊ¼ÐÐÊý
|
//
|
public DAL.ClsCB_ItemMoneyBill_Tmp oBill = new DAL.ClsCB_ItemMoneyBill_Tmp();
|
public DAL.ClsGy_ItemMoney_View oItemMoney = new DAL.ClsGy_ItemMoney_View();
|
public DAL.ClsGy_Room_View oRoom = new DAL.ClsGy_Room_View();
|
|
/// <summary>
|
/// ³õʼ»¯½çÃæ
|
/// </summary>
|
public override void initData()
|
{
|
base.initData();
|
base.sSheetName = "2ºÅÂ¥¿Õµ÷";
|
base.ModRightName = "Gy_DataIn_HouseNo2";
|
base.ModRightNameCheck = base.ModRightName + base.ModRightNameCheck;
|
base.ModRightNameClose = base.ModRightName + base.ModRightNameClose;
|
base.ModRightNameDelete = base.ModRightName + base.ModRightNameDelete;
|
base.ModRightNameEdit = base.ModRightName + base.ModRightNameEdit;
|
base.ModRightNameMoney = base.ModRightName + base.ModRightNameMoney;
|
base.ModRightNameQty = base.ModRightName + base.ModRightNameQty;
|
base.ModCaption = "¿Õµ÷2ºÅÂ¥µ¼Èë";
|
this.Text = base.ModCaption;
|
lblCaption.Text = base.ModCaption;
|
//
|
DBUtility.Gy_BaseFun.SetComboxYear(cmbHYear);
|
DBUtility.Gy_BaseFun.SetComboxPeriod(cmbHPeriod);
|
//
|
}
|
|
public override void Sub_DataIn()
|
{
|
bool b = false;
|
//base.Sub_DataIn();
|
//
|
//ɾ³ý Ïàͬ»á¼ÆÆÚ¼ä£¬Ïàͬ·ÑÓÃÏîÄ¿£¬µÄËùÓмǼ
|
if (oBill.DeleteBill(0, DBUtility.ClsPub.isLong(cmbHYear.Text), DBUtility.ClsPub.isLong(cmbHPeriod.Text),"air2", ref DBUtility.ClsPub.sExeReturnInfo))
|
{
|
b = true;
|
}
|
for (int i = HBeginRow; i <= grdMain.Rows.Count - 1; i++)
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HRoomIDCol].Value) != "")
|
{
|
//дÈëÀà
|
if (WriteClass(i))
|
{
|
|
//±£´æ¼Ç¼
|
if (!oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo))
|
{
|
MessageBox.Show("µ¼Èëʧ°Ü!ÔÒò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ");
|
return;
|
}
|
}
|
}
|
}
|
MessageBox.Show("µ¼ÈëÍê±Ï");
|
grdMain.DataSource = null;
|
}
|
|
//дÈëÀà ´Ó¿Ø¼þ
|
private bool WriteClass(int row)
|
{
|
//ÅжÏÊÇ·ñÔÊÐí ±£´æ
|
//µÃµ½Òµ»§ÄÚÂ룬·ÑÓÃÏîÄ¿ÄÚÂë
|
string sItemMoneyName = "¿Õµ÷ÖÆÈÈ";
|
string sHRoomName = "2." + DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HRoomIDCol].Value);
|
//
|
sHRoomName = sHRoomName.Replace("-", "¡ª");
|
char c = Convert.ToChar("¡ª");
|
string[] sr;
|
sr = sHRoomName.Split(c);
|
sHRoomName = sr[0].ToString();
|
//
|
//µÃµ½·ÑÓÃÏîÄ¿ÄÚÂë
|
if (oItemMoney.GetInfoByName(sItemMoneyName))
|
{
|
oBill.omodel.HItMoneyID = oItemMoney.omodel.HItemID;
|
}
|
else
|
{
|
oBill.omodel.HItMoneyID = 0;
|
}
|
|
//µÃµ½Òµ»§ÄÚÂë
|
if (oRoom.GetInfoByNumber(sHRoomName))
|
{
|
oBill.omodel.HRoomID = oRoom.omodel.HItemID;
|
}
|
else
|
{
|
oBill.omodel.HRoomID = 0;
|
MessageBox.Show("µÚ" + row.ToString() + "ÐÐ," + sHRoomName + "ûÓÐÕÒµ½¶ÔÓ¦µÄÒµ»§£¡");
|
return false;
|
}
|
|
//дÈëÐÅÏ¢
|
oBill.omodel.HYear = DBUtility.ClsPub.isLong(cmbHYear.Text);
|
oBill.omodel.HPeriod = DBUtility.ClsPub.isLong(cmbHPeriod.Text);
|
oBill.omodel.HBeginDate = DBUtility.ClsPub.isDate("1900-01-01");
|
oBill.omodel.HEndDate = DBUtility.ClsPub.isDate("1900-01-01");
|
oBill.omodel.HDate = DBUtility.ClsPub.isDate("1900-01-01");
|
oBill.omodel.HQty = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HQtyCol].Value);
|
oBill.omodel.HPrice = 0;
|
oBill.omodel.HMoney = 0;
|
oBill.omodel.HWaster = 0;
|
oBill.omodel.HBeginBalance = 0;
|
oBill.omodel.HEndBalance = 0;
|
oBill.omodel.HTimes = 0;
|
oBill.omodel.HRelationQty = 0;
|
oBill.omodel.HRelationMoney = 0;
|
oBill.omodel.HRemark = "";
|
oBill.omodel.HExplanation = "";
|
oBill.omodel.HBillSubType = "air2";
|
return true;
|
}
|
|
|
}
|
}
|