Esempio n. 1
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            string sql = "Select EMP_ID,EMP_I1,EMP_NM,DEP_ID,INH_DT From FILB01A Where  "
                         + " DEL_BT is null or DEL_BT=0 and DEP_ID in (Select DEP_ID  from SYS_SECURITY_DEP" +
                         " where MNU_ID=" + this.Tag + " and ALL_BT=1 and USER_ID=N'" + PublicFunction.A_UserID + "')";

            Func.RecordSet rs  = new Func.RecordSet(sql, PublicFunction.C_con);
            frmSearch      dlg = new frmSearch(rs, 5, "frmTaStaffInfo_vs");

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (checkBox1.Checked)
                {
                    txt_WID.Text = rs.record(rs.Bookmarks, "EMP_I1");
                }
                else
                {
                    txt_WID.Text = rs.record(rs.Bookmarks, "EMP_ID");
                }
                EMP_ID        = rs.record(rs.Bookmarks, "EMP_ID");
                EMP_I1        = rs.record(rs.Bookmarks, "EMP_I1");
                txt_Name.Text = rs.record(rs.Bookmarks, "EMP_NM");
                txt_Dep.Text  = T_String.GetDataFromSQL("DEP_NM", "FILA02A", "DEP_ID=N'" + rs.record(rs.Bookmarks, "DEP_ID") + "'");
                try
                {
                    txt_INH.Text = DateTime.Parse(rs.record(rs.Bookmarks, "INH_DT") + "").ToString(format);
                }
                catch {}
                txt_item.Focus();
                ok = true;
            }
        }
Esempio n. 2
0
        private void nav_TBarClick(object sender, ToolBarButtonClickEventArgs e)
        {
            if (e.Button.Equals(nav.cmd_refresh))
            {
//				if(nav.wh!="")
//					nav.ToolBar_Click(e);
//				else
//					nav.Show_VS("DEP_ID in "+T_String.DEP_ID(this.Tag));
                if (txt1.Text != vs.Cols[txt1.Tag + ""].Caption && txt1.Text != "")
                {
                    textBox1_KeyDown(txt1, new System.Windows.Forms.KeyEventArgs(Keys.Enter));
                }
                else
                {
                    if (txt2.Text != vs.Cols[txt2.Tag + ""].Caption && txt2.Text != "")
                    {
                        textBox1_KeyDown(txt2, new System.Windows.Forms.KeyEventArgs(Keys.Enter));
                    }
                    else
                    {
                        if (txt3.Text != vs.Cols[txt3.Tag + ""].Caption && txt3.Text != "")
                        {
                            textBox1_KeyDown(txt3, new System.Windows.Forms.KeyEventArgs(Keys.Enter));
                        }
                        else
                        {
                            if (optAll.Checked == true)
                            {
                                nav.Show_VS("DEP_ID in " + T_String.DEP_ID(this.Tag) + " and YYY_YY=N'" + dt.Text + "' order by a.EMP_ID");
                                //nav.Show_VS("DEP_ID=N'"+Dep.Get_Data("DEP_ID")+"' and YYY_YY=N'"+ dt.Text+"'");
                            }
                            else
                            {
                                if (optWorking.Checked == true)
                                {
                                    nav.Show_VS("DEP_ID in " + T_String.DEP_ID(this.Tag) + " and YYY_YY=N'" + dt.Text + "' and (VAC_BT=0 or VAC_BT is null) order by a.EMP_ID");
                                }
                                else
                                {
                                    nav.Show_VS("DEP_ID in " + T_String.DEP_ID(this.Tag) + " and YYY_YY=N'" + dt.Text + "' and VAC_BT=1 order by a.EMP_ID");
                                }
                            }
//							nav.Show_VS("DEP_ID in "+T_String.DEP_ID(this.Tag) +" and YYY_YY=N'"+dt.Text+"'" );
                        }
                    }
                }

                for (int i = 1; i < vs.Rows.Count; i++)
                {
//					if(vs.Rows[i]["VAC_BT"]+""=="True")
//					{
//						for(int c=1;c<vs.Cols.Count;c++)
//							vs.SetCellStyle(i,c, vs.Styles["VAC_BT"]);
//					}
                    CAL(i);
                }
                return;
            }
            nav.ToolBar_Click(e);
        }
Esempio n. 3
0
        public void TongCong(string EMP_ID, string YYY_MM, int SEQ_NO, SqlConnection con1)
        {
            //			PublicFunction.Copy_Table(
            string sql = "Select * from FILD01B where  BEF_BT=1 and AFT_BT=1 and ITE_NM IN (SELECT '['+COL_NM+']' FROM FILD01A) and SUM_BT=1";

            Func.RecordSet rs2 = new Func.RecordSet(sql + " ORDER BY SEQ_N1", con1);
            for (int n = 0; n < rs2.rows; n++)
            {
                try
                {
                    string ITE_NM = rs2.record(n, "ITE_NM");
                    Double ITE_NM3, ITE_NM4;

                    ITE_NM3 = T_String.IsNullTo00(T_String.GetDataFromSQL(ITE_NM, "FILD02A",
                                                                          "EMP_ID=N'" + EMP_ID + "' and YYY_MM=N'" + YYY_MM + "' and SEQ_NO=3"));
                    ITE_NM4 = T_String.IsNullTo00(T_String.GetDataFromSQL(ITE_NM, "FILD02A",
                                                                          "EMP_ID=N'" + EMP_ID + "' and YYY_MM=N'" + YYY_MM + "' and SEQ_NO=4"));
                    sql = "update FILD02A set " + ITE_NM + "=" + (ITE_NM3 + ITE_NM4) + " where EMP_ID=N'" + EMP_ID + "' and YYY_MM=N'" + YYY_MM + "' and SEQ_NO=2";
                    PublicFunction.SQL_Execute(sql, con1);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + " " + sql);
                }
            }
        }
Esempio n. 4
0
        private string FunSql(string EMP_ID, string sql, string YYY_MM, SqlConnection con)
        {
            DateTime dt = new DateTime(T_String.IsNullTo0(PublicFunction.S_Left(YYY_MM, 4)),
                                       T_String.IsNullTo0(PublicFunction.S_Right(YYY_MM, 2)), 1);

//			if(sql.IndexOf("[DayOfMonth()]")>0)
//				sql=sql.Replace("[DayOfMonth()]",DayOfMonth(dt)+"");
//			if(sql.IndexOf("[SundayOfMonth()]")>0)
//				sql=sql.Replace("[SundayOfMonth()]",SundayOfMonth(dt)+"");
//			sql=sql.Replace("[SaturdayOfMonth()]",SaturdayOfMonth(dt)+"");
//			sql=sql.Replace("[HolidayOfMonth()]",HolidayOfMonth(dt,con)+"");

            if (sql.IndexOf("[DayOfMonth()]") > 0)
            {
                sql = sql.Replace("[DayOfMonth()]", DayOfMonth() + "");
            }
            if (sql.IndexOf("[SundayOfMonth()]") > 0)
            {
                sql = sql.Replace("[SundayOfMonth()]", SundayOfMonth() + "");
            }
            sql = sql.Replace("[SaturdayOfMonth()]", SaturdayOfMonth() + "");
            sql = sql.Replace("[HolidayOfMonth()]", HolidayOfMonth(con) + "");
            // ___________________________________________________
            sql = sql.Replace("[CalDate_From()]", CalDate_From() + "");
            sql = sql.Replace("[CalDate_To()]", CalDate_To() + "");
            sql = sql.Replace("[CalDate_Month()]", CalDate_Month() + "");
            //sql=sql.Replace("[VacateDays())]",VacateDays()+"");
            if (sql.IndexOf("[VacateDaysNoSUN()]") > 0)
            {
                sql = sql.Replace("[VacateDaysNoSUN()]", VacateDaysNoSUN(EMP_ID, con, dt) + "");
            }
            return(sql);
        }
Esempio n. 5
0
        private void dt2_Leave(object sender, System.EventArgs e)
        {
            DateTime d1  = (DateTime)dt1.Value;
            DateTime d2  = (DateTime)dt2.Value;
            int      day = 0;

            while (T_String.IsNullTo0(d1.ToString("yyyyMMdd")) <= T_String.IsNullTo0(d2.ToString("yyyyMMdd")))         // tung Ngay
            {
                day++;
                d1 = d1.AddDays(1);
            }
            if (day >= 15)
            {
                cb.SelectedValue = 2;
            }
            else
            {
                cb.SelectedValue = 1;
            }
            if (((DateTime)dt1.Value).Day < 15)
            {
                dt3.Value = dt1.Value;
            }
            else
            {
                dt3.Value = dt2.Value;
            }
        }
Esempio n. 6
0
 private void nav_TBarClick(object sender, ToolBarButtonClickEventArgs e)
 {
     if (e.Button.Equals(nav.cmd_add))
     {
         if (MessageBox.Show(PublicFunction.L_Get_Msg("msg", 218), this.Text, MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             if (vs.Rows.Count == 1 || (int)vs.Rows[vs.Rows.Count - 1].UserData != 2)
             {
                 nav.ToolBar_Click(e);
             }
             vs.Rows[vs.Rows.Count - 1]["LEA_ID"] = T_String.GetMax("MAX(LEA_ID)", "FILA15A").ToString("000");
             return;
         }
     }
     if (e.Button.Equals(nav.cmd_save))
     {
         for (int i = 1; i < vs.Rows.Count; i++)
         {
             vs.Rows[i]["SEQ_NO"] = i.ToString("000");
             if (vs.Rows[i].UserData + "" != "2")
             {
                 vs.Rows[i].UserData = 1;
             }
         }
     }
     nav.ToolBar_Click(e);
 }
Esempio n. 7
0
        private void Init_Tree()
        {
            if (vs.Row < 1)
            {
                vs1.Rows.Count = 1;
                return;
            }
            ar = new ArrayList();
            ar.Add(null);
            string USER_ID = vs.Rows[vs.Row]["USER_ID"] + "";

            CheckSEC(USER_ID);
            vs1.Styles["Normal"].BackColor       = System.Drawing.Color.WhiteSmoke;
            vs1.Styles["Normal"].Border.Color    = System.Drawing.Color.WhiteSmoke;
            vs1.Styles["EmptyArea"].BackColor    = System.Drawing.Color.WhiteSmoke;
            vs1.Styles["EmptyArea"].Border.Color = System.Drawing.Color.WhiteSmoke;
            vs1.Rows.Count = 1;
            Node a;

            a = vs1.Rows.InsertNode(vs1.Rows.Count, 0);
            ar.Add(a);
            vs1.Rows[vs1.Rows.Count - 1]["DEP_NM"]    = T_String.GetDataFromSQL("COM_N2", "FILA01A", "ACT_BT=1");
            vs1.Rows[vs1.Rows.Count - 1]["ALL_BT"]    = false;
            vs1.Rows[vs1.Rows.Count - 1].AllowEditing = false;
            Init_TreeDetail("(DEP_HG is null OR DEP_HG='')", 1, a, USER_ID);
            vs1.AutoSizeCols();
        }
Esempio n. 8
0
        private void CheckFieldName()
        {
            string sql, frmMonth = "frmTaMonthAddUp000_vs";

            if (PublicFunction.GPS)
            {
                frmMonth = "frmTaMonthAddUp001_vs";
            }
            LEA = new Func.RecordSet("Select * from FILA15A", PublicFunction.C_con);
            for (int i = 0; i < LEA.rows; i++)
            {
                if (!Func.Fun.CheckFieldOfTable(PublicFunction.C_con, FILC06AA, "LEA_" + LEA.record(i, "LEA_ID")))
                {
                    sql = "Alter table " + FILC06AA + " Add [" + "LEA_" + LEA.record(i, "LEA_ID") + "] float";
                    PublicFunction.SQL_Execute(sql);

                    sql = T_String.IsNullTo0(T_String.GetDataFromSQL("MAX([ID])", "SYS_LABEL_VS_ATT", "[NAME]=" +
                                                                     "N'" + frmMonth + "'")) + 1 + "";
                    sql = "Insert Into SYS_LABEL_VS_ATT values(" +
                          "N'" + frmMonth + "'," + sql + ","
                          + "N'" + LEA.record(i, "LEA_NM") + "',N'" + LEA.record(i, "LEA_NM") + "',"
                          + "N'" + LEA.record(i, "LEA_NM") + "',N'" + LEA.record(i, "LEA_NM") + "',N'" + "LEA_" + LEA.record(i, "LEA_ID") + "')";
                    PublicFunction.SQL_Execute(sql);

                    sql = T_String.IsNullTo0(T_String.GetDataFromSQL("MAX([ID1])", "GP_SYS_SQL_SELECT", "[ID]=" +
                                                                     "N'" + frmMonth + "'")) + 1 + "";
                    sql = "Insert Into GP_SYS_SQL_SELECT([ID],ID1,[NAME],[FIELD],SEQ) values("
                          + "N'" + frmMonth + "'," + sql + ","
                          + "N'" + "LEA_" + LEA.record(i, "LEA_ID") + "',N'" + "LEA_" + LEA.record(i, "LEA_ID") + "'," + sql + ")";
                    PublicFunction.SQL_Execute(sql);
                }
            }
        }
Esempio n. 9
0
 private DateTime AQ800THU(string st)
 {
     try
     {
         string st11 = PublicFunction.S_Right(st, 12);
         int    y1, m1, d1;
         if (PublicFunction.CUS_ID == "0")
         {
             st11 = PublicFunction.S_Left(st, 10);
             y1   = T_String.IsNullTo0(PublicFunction.S_Right(st11, 4));
             m1   = T_String.IsNullTo0(st11.Substring(0, 2));
             d1   = T_String.IsNullTo0(st11.Substring(3, 2));
         }
         else
         {
             y1   = T_String.IsNullTo0(PublicFunction.S_Left(st11, 4));
             st11 = PublicFunction.S_Right(st11, st11.Length - 4);
             m1   = T_String.IsNullTo0(PublicFunction.S_Left(st11, 2));
             st11 = PublicFunction.S_Right(st11, st11.Length - 2);
             d1   = T_String.IsNullTo0(PublicFunction.S_Left(st11, 2));
         }
         DateTime dt1 = new DateTime(y1, m1, d1);
         return(dt1);
     }
     catch (Exception)
     {
         return(new DateTime(1, 1, 1));
     }
 }
Esempio n. 10
0
        private void TransferStaff(string EMP_ID, SqlConnection con)
        {
            checkStaff(EMP_ID, con);
            string sql = "Select * from FILC04B where EMP_ID=N'" + EMP_ID + "' and YYY_YY=N'" + YYY_YY.Text + "'";

            Func.RecordSet rs = new Func.RecordSet(sql, con);
            if (rs.rows < 0)
            {
                return;
            }
            double songay = 0;

//			songay+=T_String.IsNullTo00(rs.record(0,"HAV_QT"));
//			songay+=T_String.IsNullTo00(rs.record(0,"ADD_QT"));
//			songay+=T_String.IsNullTo00(rs.record(0,"LST_QT"));
//			songay-=T_String.IsNullTo00(rs.record(0,"DID_QT"));
            //songay-=T_String.IsNullTo00(rs.record(0,"BOR_QT"));
            songay += T_String.IsNullTo00(rs.record(0, "TLCN"));
            songay += T_String.IsNullTo00(rs.record(0, "BOR_QT"));
            songay += T_String.IsNullTo00(rs.record(0, "ADD_QT"));
            songay += T_String.IsNullTo00(rs.record(0, "LST_QT"));
            songay += T_String.IsNullTo00(rs.record(0, "SUP_QT"));
            songay -= T_String.IsNullTo00(rs.record(0, "DID_QT"));
//			if (songay - Math.Floor(songay)>0.5 && songay >0)
//			{
//				songay =Math.Floor(songay) +1 ;
//			}
            sql = "update FILC04B set LST_QT=" + songay + " where EMP_ID=N'" + EMP_ID + "' and YYY_YY=N'" +
                  ((int)(T_String.IsNullTo0(YYY_YY.Text) + 1)).ToString("0000") + "'";
            PublicFunction.SQL_Execute(sql, con);
        }
Esempio n. 11
0
        private void nav2_TBarClick(object sender, ToolBarButtonClickEventArgs e)
        {
            if (e.Button.Equals(nav2.cmd_refresh))
            {
                if (nav2.wh != "")
                {
                    nav2.ToolBar_Click(e);
                }
                else
                {
                    nav2.Show_VS("DEP_ID in " + T_String.DEP_ID(this.Tag) + "  and (VAC_BT is null or VAC_BT=0) ");
                }
                return;
            }
            if (e.Button.Equals(nav2.cmd_search))
            {
                ArrayList a = new ArrayList();
                ArrayList b = new ArrayList();
                b.Add("SEQ_DT");
                a.Add("EMP_ID");
                a.Add("EMP_I1");
                a.Add("DEP_ID");

                frmSearch1 dlg = new frmSearch1(a, b, vs2, nav2);
                dlg.and = "and (DEP_ID in " + T_String.DEP_ID(this.Tag) + ")  and (VAC_BT is null or VAC_BT=0)";
                dlg.ShowDialog();
            }
            nav2.ToolBar_Click(e);
        }
Esempio n. 12
0
 private void CAL_TT()
 {
     for (int i = 1; i < vs1.Rows.Count; i++)
     {
         vs1.Rows[i]["AMT_PR"] = T_String.IsNullTo00(vs1.Rows[i]["UNT_PR"] + "") + T_String.IsNullTo00(vs1.Rows[i]["TOP_PR"] + "");
     }
 }
Esempio n. 13
0
 private void vs1_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
 {
     if (vs1.Cols[e.Col].Name == "UNT_PR" || vs1.Cols[e.Col].Name == "TOP_PR")
     {
         vs1.Rows[e.Row]["AMT_PR"] = T_String.IsNullTo00(vs1.Rows[e.Row]["UNT_PR"] + "") + T_String.IsNullTo00(vs1.Rows[e.Row]["TOP_PR"] + "");
     }
 }
Esempio n. 14
0
 private void nav_TBarClick(object sender, ToolBarButtonClickEventArgs e)
 {
     if (e.Button.Equals(nav.cmd_add))
     {
         nav.ToolBar_Click(e);
         vs.Rows[vs.Rows.Count - 1]["BLT_NM"] = PublicFunction.A_UserID;
         vs.Rows[vs.Rows.Count - 1]["BLT_DT"] = T_String.GetDate().ToString("yyyy/MM/dd HH:mm");
         return;
     }
     if (e.Button.Equals(nav.cmd_save))
     {
         if (T_String.IsNullTo0(vs.Rows[vs.Row].UserData + "") == 1)
         {
             vs.Rows[vs.Row]["LST_NM"] = PublicFunction.A_UserID;
             vs.Rows[vs.Row]["LST_DT"] = T_String.GetDate().ToString("yyyy/MM/dd HH:mm");
         }
         nav.ToolBar_Click(e);
         return;
     }
     if (e.Button.Equals(nav.cmd_delete))
     {
         nav.ToolBar_Click(e);
         string sql = "Delete from P_FILB01A where STY_NO not in(Select STY_NO from P_FILB01A)";
         PublicFunction.SQL_Execute(sql);
         return;
     }
     if (e.Button.Equals(nav.cmd_refresh))
     {
         Show_vs1();
         return;
     }
     nav.ToolBar_Click(e);
 }
Esempio n. 15
0
        public static void  Copy_Table(string FromTable, string NewTable, string IDTable, OleDbConnection conm, SqlConnection con)
        {
            string sql, st = "", key = "";

            sql = "SELECT * from hqtan_FD where id=" + IDTable + " order by colid ";
            RecordSetMDB rs = new RecordSetMDB(sql, conm);

            for (int i = 0; i < rs.rows; i++)
            {
                if (i != 0)
                {
                    st += ",";
                }
                st += "[" + rs.record(i, "name") + "] ";          // ten bang
                st += rs.record(i, "datatype");
                if (PublicFunction.S_Right(rs.record(i, "datatype"), 4) == "char" || PublicFunction.S_Right(rs.record(i, "datatype"), 6) == "binary")
                {
                    st += "(" + T_String.IsNullTo0(rs.record(i, "length")) / 2 + ") "; // chieu dai
                }
                if (rs.record(i, "cdefault") + "" != "0")                              // default
                {
                    string tam = T_String.GetDataFromSQL("text", "syscomments", "id=" + rs.record(i, "cdefault"));
                    if (tam != "")
                    {
                        st += " Default " + tam;
                    }
                }
                if (rs.record(i, "isnullable") + "" == "0")           // allow null
                {
                    st += " not null";
                }
                int count = T_String.IsNullTo0(T_String.GetDataFromSQL("Count(*)", "sysindexkeys", "indid=1 and id=" + IDTable + " and colid=" + rs.record(i, "colid")) + "");
                if (count > 0)
                {
                    if (key != "")
                    {
                        key += ",";
                    }
                    key += "[" + rs.record(i, "name") + "] ";
                }
            }
            st = "Create Table [" + NewTable + "](" + st;
            if (key != "")
            {
                int count = T_String.IsNullTo0(T_String.GetDataFromSQL("Count(*)", "sysobjects", "name='" + NewTable + "'"));
                if (count <= 0)
                {
                    st += " , CONSTRAINT PK_" + NewTable + " PRIMARY KEY (" + key + "))";
                }
                else
                {
                    st += " , CONSTRAINT PK1_" + NewTable + " PRIMARY KEY (" + key + "))";
                }
            }
            else
            {
                st += ")";
            }
            PublicFunction.SQL_Execute(st, con);
        }
Esempio n. 16
0
        private void frmTaCardDataSwitch_Load(object sender, System.EventArgs e)
        {
            Basic.Function.PublicFunction.L_Init_Label(this);
            control1.InitCB(this.Tag);
            control1.Initlabel();
//			dt3.Value=dt2.Value=dt1.Value=T_String.GetDate();
            int day = T_String.IsNullTo0(PublicFunction.GetOption("DAYCLOSE") + "");

            if (day <= 0)
            {
                day = 1;
            }

            dt1.Value        = DateTime.Parse((day < 15 ? T_String.GetDate().ToString("yyyy/MM") : T_String.GetDate().AddMonths(-1).ToString("yyyy/MM")) + "/" + day);
            dt2.Value        = ((DateTime)dt1.Value).AddMonths(1).AddDays(-1);
            dt3.Value        = dt2.Value;
            dt1.CustomFormat = dt2.CustomFormat = PublicFunction.GetOption("DATE");

            string sql = "Select FNAME," + PublicFunction.L_Lag + " from  SYS_LABEL where [NAME]=N'frmTaMonthAddUpCal' and (FName='1' or FName='2')";

            PublicFunction.InitCB(cb, sql, false);
            CheckFieldName();
            this.Closed     += new EventHandler(frmTaMonthAddUpCal_Closed);
            cmd_stop.Visible = false;
            cb.SelectedValue = 2;
        }
Esempio n. 17
0
        private void GetFileName2()        // Lay danh sach file chuyen du lieu
        {
            try
            {
                string    dir    = T_String.GetDataFromSQL("DIR_DR", "GP_SYS_READER", "SEQ_NO='1'", con21);
                string    FIL_NM = T_String.GetDataFromSQL("FIL_NM", "GP_SYS_READER", "SEQ_NO='1'", con21);
                DateTime  dt     = GetDateOfFileTXT(FIL_NM, "1");
                string [] f1     = Directory.GetFiles(dir);

                for (int i = 0; i < f1.Length; i++)
                {
                    if (PublicFunction.S_Right(f1[i], 4).ToUpper() == ".TXT")
                    {
                        DateTime dt1 = GetDateOfFileTXT(f1[i], "1");
                        if (T_String.CompareDate(dt1, dt))
                        {
                            int j = 0;
                            for (j = 0; j < lb3.Items.Count; j++)
                            {
                                if (T_String.CompareDate(GetDateOfFileTXT(lb3.Items[j] + "", "1"), dt1))
                                {
                                    break;
                                }
                            }
                            lb3.Items.Insert(j, f1[i]);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 18
0
        private void BonusFined(string EMP_ID, string SEQ_NO, SqlConnection con, Func.RecordSet sal)
        {
            string   sql = "", sql1 = "";
            DateTime d1 = (DateTime)dt1.Value;
            DateTime d2 = (DateTime)dt2.Value;

            //Xu ly khen thuong truoc sau do xu ly phat
            //Thuong
            sql = "Select DISTINCT (Select sum(AMT_QT) FROM FILD04A a LEFT OUTER JOIN FILA13A b ON a.BAF_ID=b.BAF_ID" +
                  " Where b.TPE_ID=1 and EMP_ID='" + EMP_ID +
                  "' and SEQ_DT between '" + d1.ToString("yyyy/MM/dd") + "' and '" + d2.ToString("yyyy/MM/dd") + "') AS Khenthuong," +
                  "(Select sum(AMT_QT) FROM FILD04A a LEFT OUTER JOIN FILA13A b ON a.BAF_ID=b.BAF_ID" +
                  " Where (b.TPE_ID = 0 or b.TPE_ID IS NULL) and EMP_ID='" + EMP_ID +
                  "' and SEQ_DT between '" + d1.ToString("yyyy/MM/dd") + "' and '" + d2.ToString("yyyy/MM/dd") + "') AS Xuphat" +
                  " FROM FILD04A WHERE SEQ_DT BETWEEN '" + d1.ToString("yyyy/MM/dd") + "' and '" + d2.ToString("yyyy/MM/dd") + "' AND EMP_ID='" + EMP_ID + "'";
            Func.RecordSet rsbonusfined = new Func.RecordSet(sql, con);
            if (rsbonusfined.rows != 0)
            {
                sql1 = "update " + FILC06AA + " set BOS_AM=" + T_String.IsNullTo0(rsbonusfined.record(0, "Khenthuong")) +
                       ",FIN_AM=" + T_String.IsNullTo0(rsbonusfined.record(0, "Xuphat")) + " where EMP_ID=N'" + EMP_ID + "' and YYY_MM=N'"
                       + dt3.Text + "' and SEQ_NO=" + SEQ_NO;
                PublicFunction.SQL_Execute(sql1, con, true);
                if (SEQ_NO == "2" && sal.rows > 0)
                {
                    sql1 = "update " + FILC06AA + " set BOS_AM=" + T_String.IsNullTo0(rsbonusfined.record(0, "Khenthuong")) +
                           ",FIN_AM=" + T_String.IsNullTo0(rsbonusfined.record(0, "Xuphat")) + " where EMP_ID=N'" + EMP_ID + "' and YYY_MM=N'"
                           + dt3.Text + "' and SEQ_NO=3";
                    PublicFunction.SQL_Execute(sql1, con, true);
                    sql1 = "update " + FILC06AA + " set BOS_AM=" + T_String.IsNullTo0(rsbonusfined.record(0, "Khenthuong")) +
                           ",FIN_AM=" + T_String.IsNullTo0(rsbonusfined.record(0, "Xuphat")) + " where EMP_ID=N'" + EMP_ID + "' and YYY_MM=N'"
                           + dt3.Text + "' and SEQ_NO=4";
                    PublicFunction.SQL_Execute(sql1, con, true);
                }
            }
        }
Esempio n. 19
0
        private void Init_MenuItem(MenuItem mnu, int ID)
        {
            string sql;

            sql = "Select * from SYS_MENU where H_ID=" + ID + "  and (HIDE<>1 or  HIDE is null) ORDER BY SEQ";
            Func.RecordSet rs = new Func.RecordSet(sql, PublicFunction.C_con);
            for (int i = 0; i < rs.rows; i++)
            {
                submnu[T_String.IsNullTo0(rs.record(i, "ID"))] = new MenuItem();
                if (rs.record(i, "SEC") == "True")
                {
                    submnu[T_String.IsNullTo0(rs.record(i, "ID"))].Enabled = false;
                }
                else
                {
                    submnu[T_String.IsNullTo0(rs.record(i, "ID"))].Enabled = true;
                }
                submnu[T_String.IsNullTo0(rs.record(i, "ID"))].Text  = rs.record(i, PublicFunction.L_Lag);
                submnu[T_String.IsNullTo0(rs.record(i, "ID"))].Index = T_String.IsNullTo0(rs.record(i, "SEQ"));
                mnu.MenuItems.Add(i, submnu[T_String.IsNullTo0(rs.record(i, "ID"))]);
                Init_MenuItem(submnu[T_String.IsNullTo0(rs.record(i, "ID"))], T_String.IsNullTo0(rs.record(i, "ID")));
            }
            if (rs.rows == 0)
            {
                mnu.Click += new EventHandler(menu_Click);
                //mnu.Enabled=false;
            }
        }
Esempio n. 20
0
        private void vs_EnabledChanged(object sender, EventArgs e)
        {
            string sql = "Select * from FILD05A order by MON_QT DESC";

            Func.RecordSet rs = new Func.RecordSet(sql, PublicFunction.C_con);
            vs1.Cols.Count = rs.rows + 1;
            vs1.Rows.Count = 2;
            for (int i = 1; i <= 12; i++)
            {
                vs.Cols["COL_" + i.ToString("00")].Visible = false;
            }
            for (int i = 0; i < rs.rows; i++)
            {
                try
                {
                    vs1.Cols[i + 1].Name    = rs.record(i, "COL_NO");
                    vs1.Cols[i + 1].Caption = T_String.IsNullTo00(rs.record(i, "MON_QT")).ToString("#,###");

                    vs.Cols[rs.record(i, "COL_NO")].Visible = true;
                    vs.Cols[rs.record(i, "COL_NO")].Caption = T_String.IsNullTo00(rs.record(i, "MON_QT")).ToString("#,###");
                }
                catch {}
            }
            txt1.Text = vs.Cols[txt1.Tag + ""].Caption;
            txt2.Text = vs.Cols[txt2.Tag + ""].Caption;
//			//txt3.Text=vs.Cols[txt3.Tag+""].Caption;
            vs.AutoSizeCols();
        }
Esempio n. 21
0
 private void nav_TBarClick(object sender, ToolBarButtonClickEventArgs e)
 {
     if (e.Button.Equals(nav.cmd_add))
     {
         nav.ToolBar_Click(e);
         Init_CB();
         vs.Rows[vs.Rows.Count - 1]["DEP_HG"] = vs1.Rows[vs1.Row]["DEP_ID"] + "";
         return;
     }
     if (e.Button.Equals(nav.cmd_refresh))
     {
         Init_Tree();
         return;
     }
     if (e.Button.Equals(nav.cmd_delete))
     {
         if (T_String.IsNullTo0(T_String.GetDataFromSQL("Count(*)", "FILA02A", "DEP_HG=N'" + vs.Rows[vs.Row]["DEP_ID"] + "'")) > 0)
         {
             MessageBox.Show("ko the xoa");
             return;
         }
         if (T_String.IsNullTo0(T_String.GetDataFromSQL("Count(*)", "FILB01A", "DEP_ID=N'" + vs.Rows[vs.Row]["DEP_ID"] + "'")) > 0)
         {
             MessageBox.Show("ko the xoa");
             return;
         }
     }
     nav.ToolBar_Click(e);
     if (e.Button.Equals(nav.cmd_save))
     {
         Init_CB();
     }
 }
Esempio n. 22
0
        private void frmTaGetDataFrDT_Load(object sender, System.EventArgs e)
        {
            PublicFunction.InitNav(this, vs, nav);
            nav.Msg_ExitSave = true;
            nav.Show_VS("ATT_BT=1");
            nav.ToolBar_Auto = false;
            Basic.Function.PublicFunction.L_Init_Label(this);
            vs.AllowEditing = false;

            fin1 = fin2 = false;
            //			Basic.Function.PublicFunction.L_Init_Label(this);
            stop = false;
            Get_Staff();
            dt     = T_String.GetDate().ToString("yyyy/MM/dd HH:mm");
            CRD_MN = T_String.IsNullTo0(T_String.GetDataFromSQL("CRD_MN", "GP_SYS_SETTING"));

            Thread th = new Thread(new ThreadStart(Transfer1));

            th.Priority = ThreadPriority.Highest;
            th.Start();
            Thread th1 = new Thread(new ThreadStart(Transfer2));

            th1.Priority = ThreadPriority.Highest;
            //th1.Start();
        }
        private void TransferToYear()
        {
            dt             = T_String.GetDate();
            lb.Text        = "";
            lb2.Text       = "";
            cmd_OK.Enabled = false;
            SqlConnection con = new SqlConnection(PublicFunction.C_con.ConnectionString);

            con.Open();
            string sql = "Select EMP_ID,EMP_NM from FILB01A";

            sql += " where " + control1.GetWhere("");
            Func.RecordSet rs = new Func.RecordSet(sql, con);
            for (int i = 0; i < rs.rows; i++)
            {
                if (stop)
                {
                    return;
                }
                TransferStaff(rs.record(i, "EMP_ID") + "", con);
                lb.Text   = (i + 1) + "/" + rs.rows + " __ " + ((int)(i + 1) * 100 / rs.rows) + "%";
                lb2.Text  = rs.record(i, "EMP_ID") + " __ " + rs.record(i, "EMP_NM");
                pro.Value = (int)(i + 1) * 100 / rs.rows;
            }
            lb2.Text       = PublicFunction.L_Get_Msg("Staff", 1);
            cmd_OK.Enabled = true;
        }
Esempio n. 24
0
 private void nav1_TBarClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
 {
     try
     {
         if (e.Button.Equals(nav1.cmd_add))
         {
             string st;
             if (Tree.SelectedNode.Text != "Root")
             {
                 st = T_String.Left(Tree.SelectedNode.Text, "-");
             }
             else
             {
                 st = "-1";
             }
             vs.Rows[vs.Rows.Count - 1]["H_ID"] = st;
             vs.Rows[vs.Rows.Count - 1]["ID"]   = Get_ID();
         }
         if (e.Button.Equals(nav1.cmd_report))
         {
             ArrayList arColsVisible = new ArrayList();
             for (int i = 0; i < vs.Cols.Count; i++)
             {
                 arColsVisible.Add(vs.Cols[i].Visible);
             }
             Basic.Function.ReportExcel.ExportToExcel_FromVS(vs, arColsVisible);
         }
     }
     catch (Exception) {}
 }
Esempio n. 25
0
        private void CalculateBalanceQTY(int row)
        {
            int trn_qt, acc_qt, rev_qt, bal_qt;

            trn_qt = T_String.IsNullTo0(vs.Rows[row]["TRN_QT"] + "");
            acc_qt = T_String.IsNullTo0(vs.Rows[row]["ACC_QT"] + "");
            rev_qt = T_String.IsNullTo0(vs.Rows[row]["REV_QT"] + "");
            bal_qt = T_String.IsNullTo0(vs.Rows[row]["BAL_QT"] + "");
            if (rev_qt <= 0 || (trn_qt - acc_qt == 0))     //|| bal_qt==0)
            {
                vs.Rows[row]["REV_QT"] = 0;
                bal_qt = trn_qt - acc_qt;
                vs.Rows[row]["BAL_QT"] = bal_qt;
                return;
            }
            if (rev_qt >= (trn_qt - acc_qt))
            {
                rev_qt = trn_qt - acc_qt;
                vs.Rows[row]["REV_QT"] = rev_qt;
                vs.Rows[row]["BAL_QT"] = 0;
                return;
            }
            else
            {
                vs.Rows[row]["BAL_QT"] = trn_qt - acc_qt - rev_qt;
                return;
            }
        }
Esempio n. 26
0
        private void cal(string EMP_ID, string YYY_MM, string SEQ_NO, double AMT_QT, SqlConnection con)
        {
            double tien = AMT_QT;
            string sql  = "";

            for (int i = 0; i < rsm.rows; i++)
            {
                int MON_QT = T_String.IsNullTo0(rsm.record(i, "MON_QT"));
                if (MON_QT <= 0)
                {
                    break;
                }
                int m = (int)(tien / MON_QT);
                tien = tien - (m * MON_QT);
                if (sql != "")
                {
                    sql += ",";
                }
                sql += rsm.record(i, "COL_NO") + "=" + m;
            }
            if (sql == "")
            {
                return;
            }
            sql = "Update FILD06A set " + sql + " where EMP_ID=N'" + EMP_ID + "' and YYY_MM=N'" + YYY_MM + "' and SEQ_NO=" + SEQ_NO;
            try
            {
                PublicFunction.SQL_Execute(sql, con);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 27
0
 private void cmd_ok_Click(object sender, System.EventArgs e)
 {
     if (MessageBox.Show(PublicFunction.L_Get_Msg("msg", 123), this.Text, MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         DateTime d1  = (DateTime)dt1.Value;
         DateTime d2  = (DateTime)dt2.Value;
         string   sql = string.Format("Delete  From {0} where ATT_DT between '", Function.Common.Ints.tbChamCong) + d1.ToString("yyyy/MM/dd") + "'"
                        + " and '" + d2.ToString("yyyy/MM/dd") + "' and EMP_ID in (Select EMP_ID from FILB01A where " +
                        control1.GetWhere("", !ck1.Checked) + ") and (LOC_B1 is null or LOC_B1=0) ";
         if (!ck.Checked)
         {
             sql += " and (LOC_BT is null or LOC_BT=0)";
         }
         PublicFunction.SQL_Execute(sql);
         //ghi vao bang lich su chuyen va khoi tao du lieu
         int HIS_NO = 0;
         HIS_NO = T_String.GetMax("MAX(SEQ_NO)", "HistoryOfFILA06A");
         if (HIS_NO > 5000)
         {
             PublicFunction.SQL_Execute("DELETE HistoryOfFILA06A WHERE SEQ_NO<=" + HIS_NO + "-5000");
             PublicFunction.SQL_Execute("UPDATE HistoryOfFILA06A SET SEQ_NO=SEQ_NO-1 ");
             HIS_NO = T_String.GetMax("MAX(SEQ_NO)", "HistoryOfFILA06A");
         }
         sql = "insert into HistoryOfFILA06A values (" + HIS_NO + ",getdate(),NULL,'" + PublicFunction.A_UserID + "','" + T_String.sqlsql(control1.GetWhere("", !ck1.Checked))
               + ": From: " + d1.ToString("yyyy/MM/dd") + " TO: " + d2.ToString("yyyy/MM/dd") + "','Init ATT')";
         PublicFunction.SQL_Execute(sql);
         //end
         MessageBox.Show(PublicFunction.L_Get_Msg("Staff", 1));
     }
 }
Esempio n. 28
0
 private void frmTaVacateManager_Load(object sender, System.EventArgs e)
 {
     dt3.CustomFormat = dt1.CustomFormat = dt4.CustomFormat = "yyyyMM";
     dt3.Value        = dt4.Value = T_String.GetDate();
     dt1.Value        = T_String.GetDate().AddMonths(1);
     Init_Form();
 }
Esempio n. 29
0
        private void frmTaNationality_Toilet_Load(object sender, System.EventArgs e)
        {
            //an nav
            nav.cmd_search.Visible = false;
            nav.cmd_copy.Visible   = false;
            nav.cmd_delete.Visible = false;
            nav.cmd_save.Visible   = false;
            nav.cmd_add.Visible    = false;
            nav.cmd_report.Visible = false;
            PublicFunction.InitNav(this, vs, nav);
            nav.Msg_ExitSave = true;
            //nav.Show_VS();

            nav.ToolBar_Auto = false;
            Basic.Function.PublicFunction.L_Init_Label(this);
            nav.TBarClick += new ToolBarButtonClickEventHandler(nav_TBarClick);
            Show_VS();
            //khoa sua
            for (int i = 7; i <= 26; i++)
            {
                vs.Cols[i].AllowEditing = false;
            }
            //lay ngay hien tai
            dt1.Value = dt2.Value = T_String.GetDate();
        }
Esempio n. 30
0
 private void vs_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
 {
     if (vs.Row > 0)
     {
         vs.Rows[vs.Row]["LST_NM"] = PublicFunction.A_UserID;
         vs.Rows[vs.Row]["LST_DT"] = T_String.GetDate().ToString("yyyy/MM/dd HH:mm");
     }
 }