Beispiel #1
0
 public DetailsViewModels(IUnityContainer uc, IDialogService dialogService, bool bestPosRequired,
                          InvoiceSubtypes.ValidationRuleSet currentRuleSet)
 {
     _uc              = uc;
     _dlg             = dialogService;
     _bestPosRequired = bestPosRequired;
     CurrentRuleSet   = currentRuleSet;
     // _DetailsViewList = new ObservableCollection<DetailsViewModel>();
 }
Beispiel #2
0
 public void LoadFromInvoiceViewModel(InvoiceViewModel invVm)
 {
     _invoiceDate = invVm.VmInvDate;
     _baseAmount  = invVm.VmInvTotalAmountDecimal;
     _currentValidationRuleset = invVm.CurrentSelectedValidation;
     if (invVm.PaymentConditions == null)
     {
         SkontoList = new BindingList <SkontoViewModel>();
     }
     else
     {
         _dueDays        = invVm.VmInvDueDate.Days(invVm.VmInvDate);
         _invoiceDueDate = invVm.VmInvDueDate;
         SkontoList      = invVm.PaymentConditions.SkontoList;
     }
 }
Beispiel #3
0
        public List <DocumentTypeModel> GetReferenceDocumentTypes(InvoiceSubtypes.ValidationRuleSet invcVariant)
        {
            var                      variants        = InvoiceSubtypes.GetSubtype(invcVariant);
            InvoiceSubtype           variant2Process = variants;
            IResourceService         xmlRes          = new ResourceService();
            var                      xDoc            = xmlRes.ReadXmlDocument(variant2Process.FileName);
            IEnumerable <XElement>   childs          = from xel in xDoc.Elements() select xel;
            List <DocumentTypeModel> documentType    = (from xElement in childs where !xElement.Element("english").Value.StartsWith("Cancel")
                                                        select new DocumentTypeModel()
            {
                CodeEnglish = xElement.Element("english").Value,
                TextGerman = xElement.Element("german").Value
            }).ToList <DocumentTypeModel>();

            _documentTypes = documentType;
            return(documentType);
        }
Beispiel #4
0
        public object GetRelatedDocumentEntry(InvoiceSubtypes.ValidationRuleSet formType)
        {
            switch (RefTypeSelected)
            {
            case RefType.Keine:
                return(null);

            case RefType.Storno:
                CancelledOriginalDocumentType docType = new CancelledOriginalDocumentType();
                docType.Comment = RefComment;

                if (!string.IsNullOrEmpty(RefSelectedDocType))
                {
                    docType.DocumentType          = (DocumentTypeType)Enum.Parse(typeof(DocumentTypeType), RefSelectedDocType);
                    docType.DocumentTypeSpecified = true;
                }
                docType.InvoiceDate   = RefInvDate;
                docType.InvoiceNumber = RefInvNumber;
                return(docType);

            case RefType.Verweis:
                RelatedDocumentType relDoc = new RelatedDocumentType();
                relDoc.Comment = RefComment;

                if (!string.IsNullOrEmpty(RefSelectedDocType))
                {
                    relDoc.DocumentType          = (DocumentTypeType)Enum.Parse(typeof(DocumentTypeType), RefSelectedDocType);
                    relDoc.DocumentTypeSpecified = true;
                }
                if (RefInvDate.CompareTo(new DateTime(2000, 1, 1)) > 0)
                {
                    relDoc.InvoiceDate          = RefInvDate;
                    relDoc.InvoiceDateSpecified = true;
                }
                relDoc.InvoiceNumber = RefInvNumber;
                return(relDoc);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #5
0
        private void SetRibbonVisibility(InvoiceSubtypes.ValidationRuleSet validation)
        {
            Log.TraceWrite(CallerInfo.Create(), "entering, CurrentSelectedValidation=" + validation.ToString());
            // BtnSignatur.Visible = false;
            switch (validation)
            {
            case InvoiceSubtypes.ValidationRuleSet.Industries:
                rbGrpSignSend.Visible    = true;
                btnSendByMail.Visible    = true;
                btnSendByService.Visible = true;
                //  btnSignAndMail.Visible = true;
                gbtnZustellung.Visible = true;

                btnChangeFormType.Label = "Wechsel zu " + _invoiceView.InvoiceVariantList.GetText(InvoiceSubtypes.ValidationRuleSet.Government.ToString());
                break;

            case InvoiceSubtypes.ValidationRuleSet.Government:
                rbGrpSignSend.Visible = false;
                //   btnSendByMail.Visible = false;
                btnSendByService.Visible = false;
                btnSendByMail.Visible    = false;
                gbtnZustellung.Visible   = false;

                btnChangeFormType.Label = "Wechsel zu " + _invoiceView.InvoiceVariantList.GetText(InvoiceSubtypes.ValidationRuleSet.Industries.ToString());
                break;

            case InvoiceSubtypes.ValidationRuleSet.Invalid:
                Log.TraceWrite(CallerInfo.Create(), "Ruleset invalid");
                break;

            default:
                Log.TraceWrite(CallerInfo.Create(), "selection sot found");
                throw new ArgumentOutOfRangeException();
            }
            Log.TraceWrite(CallerInfo.Create(), "exiting");
        }
Beispiel #6
0
        public static InvoiceSubtype GetSubtype(InvoiceSubtypes.ValidationRuleSet tgt)
        {
            InvoiceSubtype defaultSubtype = Variants[0];
            // if (tgt == ValidationRuleSet.Invalid) return defaultSubtype;
            var res = Variants.Find(v => v.VariantOption == tgt);

            if (res == null)
            {
                // throw new ArgumentException("Target not found");
                return(defaultSubtype);
            }
            var            invoiceVariant = res;
            InvoiceSubtype it             = new InvoiceSubtype()
            {
                DocTypeAlt        = invoiceVariant.DocTypeAlt,
                DocTypeNew        = invoiceVariant.DocTypeNew,
                DocTypeVorlageAlt = invoiceVariant.DocTypeVorlageAlt,
                FileName          = invoiceVariant.FileName,
                FriendlyName      = invoiceVariant.FriendlyName,
                VariantOption     = invoiceVariant.VariantOption
            };

            return(it);
        }