Exemple #1
0
        internal override ExtendedDocument Map(string mappedClass)
        {
            switch (mappedClass)
            {
            case "LigneFacture":
                LigneFacture la = new LigneFacture()
                {
                    lArticle     = this.Id,
                    Qts          = 1,
                    Designiation = this.Designiation,
                    PrixUnitaire = PrixVente,
                };
                return(la);

                break;

            case "LigneEcritureStock":

                var ecritureStock = new LigneEcritureStock();
                ecritureStock = DataHelpers.MapProperties(ecritureStock, this) as LigneEcritureStock;

                ecritureStock.Code         = this.Code;
                ecritureStock.Designiation = this.Designiation;
                ecritureStock.lArticle     = this.Id;
                ecritureStock.Qts          = 1;
                ecritureStock.UniteMesure  = this.nUniteMesure;

                return(ecritureStock);

            default:
                return(null);

                break;
            }
        }
Exemple #2
0
        public LigneFacture ApplyListePrix(LigneFacture ligne)
        {
            if (this.ListPrix != null && this.ListPrix != ObjectId.Empty)
            {
                var list     = ListPrix.GetObject("ListePrix") as ListePrix;
                var listPrix = DataHelpers.instanc().GetDataSync <PrixArticle>(a => a.ListePrix_ == ListPrix);
                if (listPrix != null)
                {
                    var firstPric = listPrix.FirstOrDefault(a => a.lArticle == ligne.lArticle);
                    if (firstPric != null)
                    {
                        ligne.PrixUnitaire = firstPric.Taux;
                    }
                }
            }

            return(ligne);
        }
Exemple #3
0
        public void EnvoyerCuisine()
        {
            var settings          = PosSettings.getInstance();
            var imprimanteCuisine = settings.POSCuisine;

            var positions = CarteLines.GroupBy(a => a.aCuisinePosition);
            var edited    = EnvoyerCuisineDeja ? "**MODIFIÉ**" : "";

            foreach (var position in positions)
            {
                Facture fac = new Facture();
                fac.EstDelivrer  = true;
                fac.Position     = this.Position;
                fac.Client       = this.Client?.Id;
                fac.NomClient    = this.Client?.NomComplet;
                fac.DateCreation = DateTime.Now;

                fac.Remarques = $"{this.ticketType.ToString()} {this.Numero} {position.Key?.GetObject("CuisinePosition")?.Name} {edited} ";
                var repas = this.CarteLines.Where(a => a.aCuisinePosition == position.Key);
                foreach (var item in repas)
                {
                    var deffirence = item.Qts - item.OldQts;
                    if (deffirence > 0 && item.OldQts > 0)
                    {
                        item.Message += $" QTS +{deffirence}";
                    }
                    if (deffirence < 0 && item.OldQts > 0)
                    {
                        item.Message += $" QTS {deffirence}";
                    }

                    LigneFacture line = item.article.Map("LigneFacture") as LigneFacture;
                    line.PrixUnitaire = item.PricUnitaire;
                    line.Qts          = item.Qts;
                    line.Details      = item.variante?.Name + " " + item.Message;
                    fac.ArticleFacture.Add(line);

                    if (item.Message?.Contains('L') == false)
                    {
                        item.Message += new string('L', 1);
                    }

                    item.OldQts = item.Qts;
                }

                if (string.IsNullOrWhiteSpace(settings.NomTemplateCuisine))
                {
                    MessageBox.Show("Définis le modéle d'impression dans paramétres");
                    return;
                }
                var doc = fac.ExportWORD(fac.GetType(), settings.NomTemplateCuisine, !settings.DontUseHeader);
                try
                {
                    ProcessStartInfo info = new ProcessStartInfo(doc);
                    info.Arguments      = "\"" + imprimanteCuisine + "\"";
                    info.Verb           = "Printto";
                    info.CreateNoWindow = true;
                    info.WindowStyle    = ProcessWindowStyle.Hidden;
                    Process.Start(info);
                    EstEnvoyerCuisine  = true;
                    EnvoyerCuisineDeja = true;
                }
                catch (Exception s)
                {
                    MessageBox.Show(s.Message);
                }
            }
        }