Beispiel #1
0
        protected void FillRecipient()
        {
            CompanyRecord company = CompanyRecord.GetDefault() ?? new CompanyRecord();

            RecipientName         = company.Name;
            RecipientNumber       = company.Bulstat;
            RecipientTaxNumber    = company.TaxNumber;
            RecipientCity         = company.City;
            RecipientAddress      = company.Address;
            RecipientTelephone    = company.Telephone;
            RecipientLiablePerson = company.LiablePerson;
        }
Beispiel #2
0
        protected void FillSupplier()
        {
            CompanyRecord company = CompanyRecord.GetDefault() ?? new CompanyRecord();

            SupplierName         = company.Name;
            SupplierNumber       = company.Bulstat;
            SupplierTaxNumber    = company.TaxNumber;
            SupplierCity         = company.City;
            SupplierAddress      = company.Address;
            SupplierLiablePerson = company.LiablePerson;
            SupplierTelephone    = company.Telephone;
            SupplierBankName     = company.BankName;
            SupplierBankBIC      = company.BankCode;
            SupplierBankAccount  = company.BankAccount;
        }
Beispiel #3
0
        public ProductionProtocol(ComplexProduction production)
            : this()
        {
            ProtocolDate   = BusinessDomain.GetFormattedDate(production.Date);
            ProtocolNumber = production.FormattedOperationNumber;
            Note           = production.Note;

            CompanyRecord company = CompanyRecord.GetDefault();

            CompanyName         = company.Name;
            CompanyNumber       = company.Bulstat;
            CompanyCity         = company.City;
            CompanyAddress      = company.Address;
            CompanyTelephone    = company.Telephone;
            CompanyLiablePerson = company.LiablePerson;

            Location = production.Location2;

            double vat = production.VAT;

            if (BusinessDomain.AppConfiguration.VATIncluded)
            {
                Total        = Currency.ToString(production.Total - vat, PriceType.Purchase);
                Vat          = Currency.ToString(vat, PriceType.Purchase);
                TotalPlusVat = production.Total;
            }
            else
            {
                Total        = Currency.ToString(production.Total, PriceType.Purchase);
                Vat          = Currency.ToString(vat, PriceType.Purchase);
                TotalPlusVat = production.Total + vat;
            }

            int i = 1;

            foreach (ComplexProductionDetail detail in production.Details)
            {
                ProtocolDetailsMaterials.Add(new ProtocolDetail(i++, detail));
            }

            i = 1;
            foreach (ComplexProductionDetail detail in production.DetailsProd)
            {
                ProtocolDetailsProducts.Add(new ProtocolDetail(i++, detail));
            }
        }
Beispiel #4
0
        public StockTakingProtocol(StockTaking stockTaking)
            : this()
        {
            ProtocolDate   = BusinessDomain.GetFormattedDate(stockTaking.Date);
            ProtocolNumber = stockTaking.FormattedOperationNumber;
            Note           = stockTaking.Note;

            CompanyRecord company = CompanyRecord.GetDefault();

            CompanyName         = company.Name;
            CompanyNumber       = company.Bulstat;
            CompanyCity         = company.City;
            CompanyAddress      = company.Address;
            CompanyTelephone    = company.Telephone;
            CompanyLiablePerson = company.LiablePerson;

            Location = stockTaking.Location2;

            double vat = stockTaking.VAT;

            if (BusinessDomain.AppConfiguration.VATIncluded)
            {
                Total        = Currency.ToString(stockTaking.Total - vat);
                Vat          = Currency.ToString(vat);
                TotalPlusVat = stockTaking.Total;
            }
            else
            {
                Total        = Currency.ToString(stockTaking.Total);
                Vat          = Currency.ToString(vat);
                TotalPlusVat = stockTaking.Total + vat;
            }

            int i = 1;

            foreach (StockTakingDetail detail in stockTaking.Details)
            {
                StockTakingProtocolDetail stockTakingProtocolDetail = new StockTakingProtocolDetail(i++, detail, false);
                stockTakingProtocolDetail.ExpectedQuantity = Quantity.ToString(detail.ExpectedQuantity);
                stockTakingProtocolDetail.EnteredQuantity  = Quantity.ToString(detail.EnteredQuantity);
                StockTakingProtocolDetails.Add(stockTakingProtocolDetail);
            }

            TotalQuantity = Quantity.ToString(stockTaking.Details.Sum(d => d.EnteredQuantity));
        }
Beispiel #5
0
        public WasteProtocol(Waste waste)
            : this()
        {
            ProtocolDate   = BusinessDomain.GetFormattedDate(waste.Date);
            ProtocolNumber = waste.FormattedOperationNumber;
            Note           = waste.Note;

            CompanyRecord company = CompanyRecord.GetDefault();

            CompanyName         = company.Name;
            CompanyNumber       = company.Bulstat;
            CompanyCity         = company.City;
            CompanyAddress      = company.Address;
            CompanyTelephone    = company.Telephone;
            CompanyLiablePerson = company.LiablePerson;

            Location = waste.Location2;
            bool      usePriceIn = !BusinessDomain.LoggedUser.HideItemsPurchasePrice;
            PriceType priceType  = usePriceIn ? PriceType.PurchaseTotal : PriceType.SaleTotal;

            double vat = waste.VAT;

            if (BusinessDomain.AppConfiguration.VATIncluded)
            {
                Total        = Currency.ToString(waste.Total - vat, priceType);
                Vat          = Currency.ToString(vat, priceType);
                TotalPlusVat = waste.Total;
            }
            else
            {
                Total        = Currency.ToString(waste.Total, priceType);
                Vat          = Currency.ToString(vat, priceType);
                TotalPlusVat = waste.Total + vat;
            }

            int i = 1;

            foreach (WasteDetail detail in waste.Details)
            {
                ProtocolDetails.Add(new ProtocolDetail(i++, detail, usePriceIn));
            }

            TotalQuantity = Quantity.ToString(waste.Details.Sum(d => d.Quantity));
        }
Beispiel #6
0
        public User CommitChanges()
        {
            if (BusinessDomain.AppConfiguration.AutoGenerateUserCodes && string.IsNullOrWhiteSpace(code))
            {
                AutoGenerateCode();
            }

            if (!string.IsNullOrEmpty(groupName) && groupId <= 1)
            {
                UsersGroup g = GroupBase <UsersGroup> .EnsureByPath(groupName, UsersGroup.Cache);

                groupId = g.Id;
            }

            bool isNew = id < 0;

            BusinessDomain.DataAccessProvider.AddUpdateUser(this);
            cache.Set(this);

            if (isNew)
            {
                BusinessDomain.RestrictionTree.ResetLevelRestrictions(id, userLevel);
                BusinessDomain.RestrictionTree.SaveRestrictions();
            }

            if (lockedLocationIdDirty)
            {
                ConfigEntry.SaveValue(LOCKED_LOCATION_KEY, LockedLocationId, id);
                lockedLocationIdDirty = false;
            }

            if (lockedPartnerIdDirty)
            {
                ConfigEntry.SaveValue(LOCKED_PARTNER_KEY, LockedPartnerId, id);
                lockedPartnerIdDirty = false;
            }

            if (defaultPartnerIdDirty)
            {
                ConfigEntry.SaveValue(DEFAULT_PARTNER_KEY, DefaultPartnerId, id);
                defaultPartnerIdDirty = false;
            }

            if (defaultCompanyIdDirty)
            {
                ConfigEntry.SaveValue(DEFAULT_COMPANY_KEY, DefaultCompanyId, id);
                BusinessDomain.CurrentCompany = CompanyRecord.GetDefault();
                defaultCompanyIdDirty         = false;
            }

            if (hideItemsPurchasePriceDirty)
            {
                ConfigEntry.SaveValue(HIDE_ITEMS_PURCHASE_PRICE_KEY, HideItemsPurchasePrice, id);
                hideItemsPurchasePriceDirty = false;
            }

            if (hideItemsAvailabilityDirty)
            {
                ConfigEntry.SaveValue(HIDE_ITEMS_AVAILABILITY_KEY, HideItemsAvailability, id);
                hideItemsAvailabilityDirty = false;
            }

            if (allowZeroPricesDirty)
            {
                ConfigEntry.SaveValue(ALLOW_ZERO_PRICES_KEY, AllowZeroPrices, id);
                allowZeroPricesDirty = false;
            }

            if (BusinessDomain.LoggedUser.Id == id)
            {
                BusinessDomain.LoggedUser = this;
            }

            return(this);
        }