示例#1
0
        private void LoadData()
        {
            isInLoad   = true;
            this.Title = Caption;
            lkup.Focus();

            CTable t = new CTable("");

            vw = new MAccountDocItem(t);
            vw.CreateDefaultValue();

            DataContext = vw;

            CUtil.EnableForm(false, this);

            if (Mode.Equals("E"))
            {
                CTable newDB = actualView.GetDbObject().Clone();
                vw.SetDbObject(newDB);

                lkup.Lookup = selectionTypeToLookup(vw.SelectType);

                vw.NotifyAllPropertiesChanged();
            }
            else
            {
                vw.SelectType = CGlobalVariable.GetGlobalVariableValue("DEFAULT_SELECTION_TYPE_PERCHASE");
                lkup.Lookup   = selectionTypeToLookup(vw.SelectType);
            }

            vw.IsModified = false;
            CUtil.EnableForm(true, this);
            isInLoad = false;
        }
        private void LoadData()
        {
            this.Title = Caption;

            CTable t = new CTable("");

            vw = new MAccountDocItem(t);
            vw.CreateDefaultValue();

            DataContext   = vw;
            vw.SelectType = "1";

            CUtil.EnableForm(false, this);

            if (Mode.Equals("E"))
            {
                CTable newDB = actualView.GetDbObject().Clone();
                vw.SetDbObject(newDB);
                vw.InitItemDetails();
            }
            else
            {
                for (int i = 1; i <= 1; i++)
                {
                    MAuxilaryDocSubItem mi = new MAuxilaryDocSubItem(new CTable(""));
                    vw.AddItemDetail(mi);
                }
            }

            vw.NotifyAllPropertiesChanged();

            vw.IsModified = false;
            CUtil.EnableForm(true, this);
        }
        private void addItemFromPayroll(ArrayList arr, int type)
        {
            String projectVariable = "PAYROLL_PROJECT_CODE";
            String serviceVariable = "PAYROLL_SERVICE_CODE";

            if (type == 2)
            {
                serviceVariable = "SOCIAL_SECURITY_SERVICE_CODE";
            }

            String   projectCode = CGlobalVariable.GetGlobalVariableValue(projectVariable);
            CTable   p           = getObject(projectCode, "PROJECT_CODE", "GetProjectList", "PROJECT_LIST");
            MProject pj          = new MProject(p);

            String   serviceCode = CGlobalVariable.GetGlobalVariableValue(serviceVariable);
            CTable   s           = getObject(serviceCode, "SERVICE_CODE", "GetServiceList", "SERVICE_LIST");
            MService sv          = new MService(s);

            foreach (MVPayrollDocument pd in arr)
            {
                CTable          t   = new CTable("");
                MAccountDocItem mdi = new MAccountDocItem(t);
                mdi.CreateDefaultValue();
                mdi.SelectType = "1";
                mdi.ServiceObj = sv;
                mdi.ProjectObj = pj;

                vw.AddAccountDocItem(mdi);

                MAuxilaryDocSubItem mi = new MAuxilaryDocSubItem(new CTable(""));
                mi.Description = String.Format("{0}-{1} {2}", pd.FromSalaryDateFmt, pd.ToSalaryDateFmt, pd.EmployeeTypeDesc);
                mi.SubItemDate = pd.ToSalaryDate;
                mi.UnitPrice   = pd.ReceiveAmount;

                if (type == 2)
                {
                    mi.UnitPrice = pd.SocialSecurityCompanyAmount;
                }

                mi.Quantity = "1.00";
                mdi.AddItemDetail(mi);

                mdi.CalculateSubItemTotal();
                mdi.SerializeItemDetails();
            }
        }