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_HotWater :BLL.Gy_DataInTmp 
 | 
    { 
 | 
        public Gy_DataIn_HotWater() 
 | 
        { 
 | 
            InitializeComponent(); 
 | 
        } 
 | 
  
 | 
        public int HCollectIDCol = 1;         //²É¼¯Æ÷ÄÚÂë 
 | 
        public int HRoomIDCol = 5;            //Òµ»§ÄÚÂë 
 | 
        public int HBeginDateCol = 13;         //¿ªÊ¼ÈÕÆÚ 
 | 
        public int HEndDateCol = 10;           //½áÊøÈÕÆÚ 
 | 
        public int HItMoneyIDCol = 5;         //·ÑÓÃÏîÄ¿ 
 | 
        public int HQtyCol = 6;               //ÊýÁ¿ 
 | 
        public int HPriceCol = 7;             //µ¥¼Û 
 | 
        public int HMoneyCol = 8;             //½ð¶î 
 | 
        public int HBeginBalanceCol = 12;      //¿ªÊ¼ÊýÖµ 
 | 
        public int HEndBalanceCol = 9;        //½áÊøÊýÖµ 
 | 
        // 
 | 
        public const int HBeginRow = 2;         //ÓÐЧÊý¾Ý£¬¿ªÊ¼ÐÐÊý 
 | 
        // 
 | 
        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(); 
 | 
        public DAL.ClsGy_Collect_View oCollect = new DAL.ClsGy_Collect_View(); 
 | 
        public DAL.ClsGy_Building_View oBuilding = new DAL.ClsGy_Building_View(); 
 | 
  
 | 
        /// <summary> 
 | 
        ///  ³õʼ»¯½çÃæ 
 | 
        /// </summary> 
 | 
        public override void initData() 
 | 
        { 
 | 
            base.initData(); 
 | 
            base.sSheetName = "³±íÔ±¨±í";  
 | 
            base.ModRightName = "Gy_DataIn_HotWater"; 
 | 
            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 = "ÀäÈÈË®µ¼Èë"; 
 | 
            this.Text = base.ModCaption; 
 | 
            lblCaption.Text = base.ModCaption; 
 | 
            // 
 | 
            DBUtility.Gy_BaseFun.SetComboxYear(cmbHYear); 
 | 
            DBUtility.Gy_BaseFun.SetComboxPeriod(cmbHPeriod); 
 | 
            // 
 | 
        } 
 | 
  
 | 
        public override void Sub_DataIn() 
 | 
        { 
 | 
            //base.Sub_DataIn(); 
 | 
            // 
 | 
            bool b = false; 
 | 
            //ɾ³ý Ïàͬ»á¼ÆÆÚ¼ä£¬Ïàͬ·ÑÓÃÏîÄ¿£¬µÄËùÓмǼ  
 | 
            if (oBill.DeleteBill(0, DBUtility.ClsPub.isLong(cmbHYear.Text), DBUtility.ClsPub.isLong(cmbHPeriod.Text),"water", 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 sBuildingName = ""; 
 | 
            string sItemMoneyName; 
 | 
            string sHCollectName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HCollectIDCol].Value); 
 | 
            string sHRoomName = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HRoomIDCol].Value); 
 | 
            //¸ù¾Ý²É¼¯Æ÷£¬ÅжÏÂ¥ºÅ 
 | 
            if (oCollect.GetInfoByName(sHCollectName)) 
 | 
            { 
 | 
                if (oBuilding.GetInfoByID(oCollect.omodel.HBuildingID)) 
 | 
                { 
 | 
                    if (oBuilding.omodel.HName == "1ºÅÂ¥") 
 | 
                    { 
 | 
                        sBuildingName = "1."; 
 | 
                    } 
 | 
                    else if (oBuilding.omodel.HName == "2ºÅÂ¥") 
 | 
                    { 
 | 
                        sBuildingName = "2."; 
 | 
                    } 
 | 
                    else 
 | 
                    { 
 | 
  
 | 
                    } 
 | 
                } 
 | 
            } 
 | 
            //ÅжϷÑÓÃÏîÄ¿ 
 | 
            if (sHRoomName.Substring(sHRoomName.Length - 1) == "+") 
 | 
            { 
 | 
                sItemMoneyName = "ÈÈË®"; 
 | 
                sHRoomName = sHRoomName.Replace("+", ""); 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                sItemMoneyName = "ÀäË®"; 
 | 
                sHRoomName = sHRoomName.Replace("+", ""); 
 | 
            } 
 | 
  
 | 
            //µÃµ½·ÑÓÃÏîÄ¿ÄÚÂë 
 | 
            if (oItemMoney.GetInfoByName(sItemMoneyName)) 
 | 
            { 
 | 
                oBill.omodel.HItMoneyID = oItemMoney.omodel.HItemID; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                oBill.omodel.HItMoneyID = 0; 
 | 
            } 
 | 
  
 | 
            //µÃµ½Òµ»§ÄÚÂë 
 | 
            if (oRoom.GetInfoByNumber(sBuildingName + sHRoomName)) 
 | 
            { 
 | 
                oBill.omodel.HRoomID = oRoom.omodel.HItemID; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                oBill.omodel.HRoomID = 0; 
 | 
                MessageBox.Show("µÚ" + row.ToString() + "ÐÐ," + sBuildingName + 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(grdMain.Rows[row].Cells[HBeginDateCol].Value); 
 | 
            oBill.omodel.HEndDate = DBUtility.ClsPub.isDate(grdMain.Rows[row].Cells[HEndDateCol].Value); 
 | 
            oBill.omodel.HDate = DBUtility.ClsPub.isDate(grdMain.Rows[row].Cells[HEndDateCol].Value); 
 | 
            oBill.omodel.HQty = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HQtyCol].Value); 
 | 
            oBill.omodel.HPrice = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HPriceCol].Value); 
 | 
            oBill.omodel.HMoney = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HMoneyCol].Value); 
 | 
            oBill.omodel.HWaster = 0; 
 | 
            oBill.omodel.HBeginBalance = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HBeginBalanceCol].Value); 
 | 
            oBill.omodel.HEndBalance = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HEndBalanceCol].Value); 
 | 
            oBill.omodel.HTimes = 0; 
 | 
            oBill.omodel.HRelationQty = 0; 
 | 
            oBill.omodel.HRelationMoney = 0; 
 | 
            oBill.omodel.HRemark = ""; 
 | 
            oBill.omodel.HExplanation = "";  
 | 
            oBill.omodel.HBillSubType = "water"; 
 | 
  
 | 
            return true; 
 | 
        } 
 | 
  
 | 
  
 | 
  
 | 
    } 
 | 
} 
 |