Пример #1
0
        private void CmdAuto_Click(object sender, RoutedEventArgs e)
        {
            if (mv.EmployeeID.Equals(""))
            {
                return;
            }

            CUtil.EnableForm(false, this);

            CTable dat = new CTable("");

            dat.SetFieldValue("FROM_DOCUMENT_DATE", CUtil.DateTimeToDateStringInternalMin(mvParent.FromSalaryDate));
            dat.SetFieldValue("TO_DOCUMENT_DATE", CUtil.DateTimeToDateStringInternalMax(mvParent.ToSalaryDate));
            dat.SetFieldValue("EMPLOYEE_ID", mv.EmployeeID);

            ArrayList arr = OnixWebServiceAPI.GetListAPI("GetEmployeePayrollAccumulate", "PAYROLL_EMPLOYEE_ACCUM_LIST", dat);

            mv.ReceiveOT = getAmount(arr, "EMPLOYEE_OT");
            if (mvParent.EmployeeType.Equals("1"))
            {
                mv.ReceiveIncome = getAmount(arr, "EMPLOYEE_WORK");
            }
            mv.ReceiveTransaportation = getAmount(arr, "EMPLOYEE_EXPENSE");
            mv.DeductPenalty          = getAmount(arr, "EMPLOYEE_DEDUCTION");

            CUtil.EnableForm(true, this);
        }
Пример #2
0
        private CTable verifyAndConstructObject()
        {
            foreach (CEntry en in entries)
            {
                UIElement elm   = en.ActualUI;
                String    value = "";

                if (en.EntryType == EntryType.ENTRY_DATE_MIN)
                {
                    UDatePicker dt = (UDatePicker)elm;
                    if (dt.SelectedDate == null)
                    {
                        value = "";
                    }
                    else
                    {
                        value = CUtil.DateTimeToDateStringInternalMin((DateTime)dt.SelectedDate);
                    }
                }
                else if (en.EntryType == EntryType.ENTRY_DATE_MAX)
                {
                    UDatePicker dt = (UDatePicker)elm;
                    if (dt.SelectedDate == null)
                    {
                        value = "";
                    }
                    else
                    {
                        value = CUtil.DateTimeToDateStringInternalMax((DateTime)dt.SelectedDate);
                    }
                }
                else if (en.EntryType == EntryType.ENTRY_MONTH_YEAR)
                {
                    UDateEntry dt = (UDateEntry)elm;
                    if (dt.SelectedDate == null)
                    {
                        value = "";
                    }
                    else
                    {
                        value = CUtil.DateTimeToDateStringInternal((DateTime)dt.SelectedDate);
                    }
                }
                else if (en.EntryType == EntryType.ENTRY_TEXT_BOX)
                {
                    TextBox txt = (TextBox)elm;

                    if (!CHelper.ValidateTextBox((Label)en.ActualLabel, txt, en.NullAllowed))
                    {
                        return(null);
                    }

                    value = txt.Text;
                }
                else if (en.EntryType == EntryType.ENTRY_CHECK_BOX)
                {
                    CheckBox cbx = (CheckBox)elm;

                    value = booleanToFlag((Boolean)cbx.IsChecked);
                }
                else if (en.EntryType == EntryType.ENTRY_COMBO_BOX)
                {
                    ComboBox cbo = (ComboBox)elm;

                    if (!CHelper.ValidateComboBox((Label)en.ActualLabel, cbo, en.NullAllowed))
                    {
                        return(null);
                    }

                    MBaseModel v = (MBaseModel)cbo.SelectedItem;
                    value = en.ObjectToIndexFunction(v);
                }

                String fld = en.FieldName;
                rptCfg.SetConfigValue(fld, value, "String", "");
            }

            if (!CHelper.ValidateComboBox(lblPaperType, cboPaperType, false))
            {
                return(null);
            }

            MMasterRef mr = (MMasterRef)cboPaperType.SelectedItem;

            rptCfg.SetConfigValue((String)cboPaperType.Tag, mr.MasterID, "Integer", "");


            if (radPotrait.IsChecked == true)
            {
                rptCfg.SetConfigValue((String)lblPaperType.Tag, (String)radPotrait.Tag, "String", "");
            }
            else if (radLandScape.IsChecked == true)
            {
                rptCfg.SetConfigValue((String)lblPaperType.Tag, (String)radLandScape.Tag, "String", "");
            }

            if (cbxPageRange.IsChecked == true)
            {
                paginator.isPageRange = true;

                if (!CHelper.ValidateTextBox(lblFromPage, txtFromPage, false, InputDataType.InputTypeZeroPossitiveInt))
                {
                    return(null);
                }
                paginator.fromPage = CUtil.StringToInt(txtFromPage.Text);

                if (!CHelper.ValidateTextBox(lblToPage, txtToPage, false, InputDataType.InputTypeZeroPossitiveInt))
                {
                    return(null);
                }
                paginator.toPage = CUtil.StringToInt(txtToPage.Text);

                if (paginator.toPage < paginator.fromPage)
                {
                    CHelper.ShowErorMessage("", "ERROR_PAGE_RANGE", null);
                    txtFromPage.Focus();

                    return(null);
                }
            }

            if (!CHelper.ValidateTextBox(lblMarginLeft, txtLeft, false, InputDataType.InputTypeZeroPossitiveDecimal))
            {
                return(null);
            }
            if (!CHelper.ValidateTextBox(lblMarginTop, txtTop, false, InputDataType.InputTypeZeroPossitiveDecimal))
            {
                return(null);
            }
            if (!CHelper.ValidateTextBox(lblMarginRight, txtRight, false, InputDataType.InputTypeZeroPossitiveDecimal))
            {
                return(null);
            }
            if (!CHelper.ValidateTextBox(lblMarginBottom, txtBottom, false, InputDataType.InputTypeZeroPossitiveDecimal))
            {
                return(null);
            }

            rptCfg.SetConfigValue((String)txtFromPage.Tag, txtFromPage.Text, "String", "");
            rptCfg.SetConfigValue((String)txtToPage.Tag, txtToPage.Text, "String", "");
            rptCfg.SetConfigValue((String)txtLeft.Tag, txtLeft.Text, "String", "");
            rptCfg.SetConfigValue((String)txtTop.Tag, txtTop.Text, "String", "");
            rptCfg.SetConfigValue((String)txtRight.Tag, txtRight.Text, "String", "");
            rptCfg.SetConfigValue((String)txtBottom.Tag, txtBottom.Text, "String", "");
            CUtil.EnableForm(false, this);
            CReportConfigs.SaveReportConfig(null, rptCfg);
            CUtil.EnableForm(true, this);

            CTable tb = rptCfg.GetParamObject();

            return(tb);
        }