Ejemplo n.º 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 cmdAction_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            currentViewObj         = (MAccountDocItem)btn.Tag;
            btn.ContextMenu.IsOpen = true;
        }
        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);
        }
Ejemplo n.º 4
0
        private MAccountDoc constructInvoiceFromSaleOrder(MAccountDoc saleOrder)
        {
            CTable so = OnixWebServiceAPI.GetAccountDocInfo(saleOrder.GetDbObject());

            MAccountDoc sod = new MAccountDoc(so);

            sod.InitAccountDocItem();
            sod.InitEntityAddresses();

            MAccountDoc md = new MAccountDoc(new CTable(""));

            md.DocumentType = ((int)docType).ToString();
            md.DocumentDate = sod.DocumentDate;
            md.DocumentDesc = sod.DocumentDesc;
            md.DueDate      = sod.DocumentDate;

            md.ProjectID        = sod.ProjectID;
            md.ProjectCode      = sod.ProjectCode;
            md.ProjectName      = sod.ProjectName;
            md.ProjectGroupName = sod.ProjectGroupName;

            md.EntityId        = sod.EntityId;
            md.EntityCode      = sod.EntityCode;
            md.EntityName      = sod.EntityName;
            md.EntityAddressID = sod.EntityAddressID;

            md.EmployeeID   = sod.EmployeeID;
            md.EmployeeCode = sod.EmployeeCode;
            md.EmployeeName = sod.EmployeeName;

            CTable  cust = OnixWebServiceAPI.GetEntityInfo(sod.EntityObj.GetDbObject());
            MEntity en   = new MEntity(cust);

            en.InitEntityAddress();
            md.ReloadEntityAddresses(en.AddressItems);

            md.BranchId       = sod.BranchId;
            md.VATType        = sod.VATType;
            md.VAT_PCT        = sod.VAT_PCT;
            md.RefSaleOrderNo = sod.DocumentNo;
            md.RefSaleOrderID = sod.AccountDocId;
            md.RefPoNo        = sod.RefPoNo;
            md.RefQuotationNo = sod.RefQuotationNo;

            foreach (MAccountDocItem ad in sod.AccountItem)
            {
                MAccountDocItem adi = new MAccountDocItem(ad.GetDbObject());
                adi.ProjectID   = sod.ProjectID;
                adi.ProjectCode = sod.ProjectCode;
                adi.ProjectName = sod.ProjectName;

                adi.ExtFlag = "A";
                md.AddAccountDocItem(adi);
            }

            md.CalculateExtraFields();
            md.IsModified = true;

            return(md);
        }
 private void lsvAccoutItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (lsvAccoutItem.SelectedItems.Count == 1)
     {
         currentViewObj = (MAccountDocItem)lsvAccoutItem.SelectedItems[0];
         ShowEditWindow();
     }
 }
        private void addAccountDocItems(ArrayList items)
        {
            int ind = 0;

            MProject firstProj = null;

            foreach (MAuxilaryDocItem ai in items)
            {
                MAccountDocItem di = new MAccountDocItem(new CTable(""));
                di.ExtFlag = "A";

                di.SelectType         = ai.SelectType;
                di.ItemCode           = ai.ItemCode;
                di.ItemNameThai       = ai.ItemNameThai;
                di.ItemId             = ai.ItemId;
                di.FreeText           = ai.FreeText;
                di.ServiceCode        = ai.ServiceCode;
                di.ServiceName        = ai.ServiceName;
                di.ServiceID          = ai.ServiceID;
                di.Quantity           = ai.Quantity;
                di.Discount           = ai.Discount;
                di.UnitPrice          = ai.UnitPrice;
                di.TotalAfterDiscount = ai.TotalAfterDiscount;
                di.VatTaxFlag         = ai.VatTaxFlag;
                di.WHTaxFlag          = ai.WHTaxFlag;
                di.WHTaxPct           = ai.WHTaxPct;
                di.VatTaxPct          = ai.VatTaxPct;
                di.ItemNote           = ai.DocumentNo;
                di.ProjectID          = ai.ProjectID;
                di.ProjectCode        = ai.ProjectCode;
                di.ProjectName        = ai.ProjectName;
                di.ProjectGroupName   = ai.ProjectGroupName;
                di.RefPoNo            = ai.DocumentNo;
                di.WhGroupCriteria    = ai.WhGroup;
                di.PoItemID           = ai.AuxilaryDocItemID;
                di.PoID = ai.AuxilaryDocID;

                if (ind == 0)
                {
                    firstProj = (MProject)di.ProjectObj;
                }

                ind++;

                vw.AddAccountDocItem(di);
            }

            if (vw.ProjectID.Equals("") && (firstProj != null))
            {
                //If not yet been set
                vw.ProjectObj = firstProj;
            }

            String poString = vw.GetRefPoString();

            vw.RefPoNo = poString;
        }
        private void populateTempFields(CTable o)
        {
            MAccountDocItem di = new MAccountDocItem(o);

            o.SetFieldValue("SELECTED_ITEM_CODE", di.SelectItemCode);
            o.SetFieldValue("SELECTED_ITEM_CODE", di.SelectItemCode);
            o.SetFieldValue("SELECTED_ITEM_NAME", di.SelectItemName);
            o.SetFieldValue("SELECTED_UNIT_NAME", di.UnitName);

            di = null;
        }
Ejemplo n.º 8
0
        private MAccountDocItem getLatestItem(ObservableCollection <MAccountDocItem> items)
        {
            MAccountDocItem m   = null;
            int             cnt = items.Count;

            if (cnt > 0)
            {
                m = (MAccountDocItem)items[cnt - 1];
            }

            return(m);
        }
Ejemplo n.º 9
0
        private MAccountDoc constructSaleOrderFromQuotation(MAuxilaryDoc quotation)
        {
            CTable qt = OnixWebServiceAPI.GetAuxilaryDocInfo(quotation.GetDbObject());

            MAuxilaryDoc qd = new MAuxilaryDoc(qt);

            qd.InitAuxilaryDocItem();
            qd.InitEntityAddresses();

            MAccountDoc md = new MAccountDoc(new CTable(""));

            md.DocumentType = ((int)AccountDocumentType.AcctDocSaleOrder).ToString();
            md.DocumentDate = qd.DocumentDate;
            md.DocumentDesc = qd.DocumentDesc;
            md.DueDate      = qd.DocumentDate;

            md.ProjectID        = qd.ProjectID;
            md.ProjectCode      = qd.ProjectCode;
            md.ProjectName      = qd.ProjectName;
            md.ProjectGroupName = qd.ProjectGroupName;

            md.EntityId        = qd.EntityId;
            md.EntityCode      = qd.EntityCode;
            md.EntityName      = qd.EntityName;
            md.EntityAddressID = qd.EntityAddressID;

            md.EmployeeID   = qd.EmployeeID;
            md.EmployeeCode = qd.EmployeeCode;
            md.EmployeeName = qd.EmployeeName;

            CTable  cust = OnixWebServiceAPI.GetEntityInfo(qd.EntityObj.GetDbObject());
            MEntity en   = new MEntity(cust);

            en.InitEntityAddress();
            md.ReloadEntityAddresses(en.AddressItems);

            md.BranchId       = qd.BranchId;
            md.VATType        = qd.VatType;
            md.RefQuotationNo = qd.DocumentNo;
            md.RefQuotationID = qd.AuxilaryDocID;

            foreach (MAuxilaryDocItem ad in qd.AuxilaryDocItems)
            {
                MAccountDocItem adi = new MAccountDocItem(ad.GetDbObject());
                adi.ExtFlag = "A";
                md.AddAccountDocItem(adi);
            }

            md.CalculateExtraFields();
            md.IsModified = true;

            return(md);
        }
        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();
            }
        }
Ejemplo n.º 11
0
        protected override ArrayList createPageParam()
        {
            int         itemPerPage = CUtil.StringToInt(rptCfg.GetConfigValue("ItemPerPage"));
            MAccountDoc ad          = dataSource as MAccountDoc;

            ad.AccountItem.Clear();

            //ArrayList arr = createPageParamEasy((dataSource as MAccountDoc).AccountItem, itemPerPage);

            MAccountDocItem mi = new MAccountDocItem(new Wis.WsClientAPI.CTable(""));

            mi.SelectType         = "3";
            mi.FreeText           = ad.RefDocNo;
            mi.Quantity           = "1";
            mi.UnitPrice          = ad.RevenueExpenseAmt;
            mi.TotalAfterDiscount = ad.RevenueExpenseAmt;
            ad.AccountItem.Add(mi);

            ArrayList arr = createPageParamComplex(ad.AccountItem, itemPerPage);

            return(arr);
        }
        private String getKey(MAccountDocItem di)
        {
            String key = String.Format("{0}-{1}-{2}-{3}", di.SelectType, di.ItemId, di.ServiceID, di.IsTrayFlag);

            return(key);
        }
Ejemplo n.º 13
0
 public CAccountDocItem(MAccountDocItem di, String lang, MReportConfig cfg)
 {
     rptConfig = cfg;
     mi        = di;
     Lang      = lang;
 }
        private void addAccountDocCriteria(ArrayList items)
        {
            int      ind       = 0;
            MProject firstProj = null;

            foreach (MPaymentCriteria ai in items)
            {
                MAccountDocItem di = new MAccountDocItem(new CTable(""));
                di.ExtFlag = "A";

                di.SelectType         = "3";
                di.FreeText           = ai.Description;
                di.Quantity           = "1";
                di.Amount             = ai.PaymentAmount;
                di.UnitPrice          = ai.PaymentAmount;
                di.TotalAfterDiscount = ai.PaymentAmount;

                di.WHTaxFlag = "N";
                if (CUtil.StringToDouble(ai.WhPercent) > 0)
                {
                    di.WHTaxFlag = "Y";
                }

                di.VatTaxFlag = "N";
                if (CUtil.StringToDouble(ai.VatPercent) > 0)
                {
                    di.VatTaxFlag = "Y";
                }

                di.WHTaxPct  = ai.WhPercent;
                di.VatTaxPct = ai.VatPercent;
                di.ItemNote  = ai.DocumentNo;

                di.ProjectID        = ai.ProjectID;
                di.ProjectCode      = ai.ProjectCode;
                di.ProjectName      = ai.ProjectName;
                di.ProjectGroupName = ai.ProjectGroupName;
                di.RefPoNo          = ai.DocumentNo;
                di.WhGroup          = ai.WHGroup;
                di.WhGroupCriteria  = ai.WHGroup;
                di.PoCriteriaID     = ai.PaymentCriteriaID;
                di.PoID             = ai.AuxilaryDocID;

                if (ind == 0)
                {
                    firstProj = (MProject)di.ProjectObj;
                }

                ind++;

                vw.AddAccountDocItem(di);
            }

            if (vw.ProjectID.Equals("") && (firstProj != null))
            {
                //If not yet been set
                vw.ProjectObj = firstProj;
            }

            String poString = vw.GetRefPoString();

            vw.RefPoNo = poString;
        }