Пример #1
0
        private void HoursAdd_Load(object sender, EventArgs e)
        {
            Contractors curForm = (Contractors)this.Owner;

            txt_HA_CCode.Text   = curForm.GetCCode();
            txt_HA_Name.Text    = curForm.GetCName();
            txt_HA_Surname.Text = curForm.GetCSurname();
            txt_HA_EName.Text   = curForm.GetEName();
            send = curForm.GetSender();

            dt = curForm.GetHours();

            if (send is Button)
            {
                btn_HA_CreateRem.Visible = false;

                txt_HA_ExcRate.Text           = "0.00000";
                txt_HA_ExcRate.SelectionStart = txt_HA_ExcRate.Text.Length;

                txt_HA_DolPH.Text           = "$0.00";
                txt_HA_DolPH.SelectionStart = txt_HA_DolPH.Text.Length;

                txt_HA_TotBE.Text           = "$0.00";
                txt_HA_TotBE.SelectionStart = txt_HA_TotBE.Text.Length;

                txt_HA_QTCut.Text           = "R0.00";
                txt_HA_QTCut.SelectionStart = txt_HA_QTCut.Text.Length;

                txt_HA_TotAE.Text           = "R0.00";
                txt_HA_TotAE.SelectionStart = txt_HA_TotAE.Text.Length;

                txt_HA_FTotal.Text           = "R0.00";
                txt_HA_FTotal.SelectionStart = txt_HA_FTotal.Text.Length;

                dtp_HA_From.Value     = DateTime.Now;
                dtp_HA_To.Value       = dtp_HA_From.Value.AddDays(6);
                dtp_HA_DatePaid.Value = DateTime.Now;

                int newCode = 0;

                foreach (DataRow dr in dt.Rows)
                {
                    if (dr.RowState == DataRowState.Deleted)
                    {
                        string str = dr["Code", DataRowVersion.Original].ToString().Trim();
                        int    pos = str.IndexOf("_");
                        int    x   = Convert.ToInt32(str.Remove(0, pos + 2));
                        if (x > newCode)
                        {
                            newCode = x;
                        }
                    }
                    else
                    {
                        string str = dr["Code"].ToString().Trim();
                        int    pos = str.IndexOf("_");
                        int    x   = Convert.ToInt32(str.Remove(0, pos + 2));
                        if (x > newCode)
                        {
                            newCode = x;
                        }
                    }
                }

                newCode++;
                txt_HA_Code.Text = txt_HA_CCode.Text.Split('_')[1] + "_" + newCode.ToString("0000");
            }
            else
            {
                Text        = "Edit Work Week";
                SELECTED_WW = curForm.GetSelectedHour();
                LoadHours();
            }
        }
Пример #2
0
        private void SetSelectedButton(object sender)
        {
            Button b    = (Button)sender;
            string name = b.Name;

            switch (name)
            {
            case "btn_Home":
            {
                selected = "Home";
                curForm  = null;
                CheckConTabOpen();
                break;
            }

            case "btn_Local":
            {
                selected = "Local";
                curForm  = new Clients();
                CheckConTabOpen();
                break;
            }

            case "btn_Int":
            {
                selected = "Int";
                curForm  = new Clients();
                CheckConTabOpen();
                break;
            }

            case "btn_Contractors":
            {
                selected = "Contractors";
                curForm  = new Contractors();
                break;
            }

            case "btn_C_NoRem":
            {
                selected = "cNoRem";
                curForm  = new NoRemittances();
                break;
            }

            case "btn_C_NoInv":
            {
                selected = "cNoInv";
                curForm  = new NoInvoices();
                break;
            }

            case "btn_Projects":
            {
                selected = "Projects";
                Projects frmProj = new Projects();
                frmProj.Owner = this;
                curForm       = frmProj;
                CheckConTabOpen();
                break;
            }

            case "btn_PettyCash":
            {
                selected = "PettyCash";
                curForm  = new PettyCash();
                CheckConTabOpen();
                break;
            }
            }
        }