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();
            }
        }
 private void txtText_TextChanged(object sender, TextChangedEventArgs e)
 {
     vw.CalculateSubItemTotal();
     vw.IsModified = true;
 }