Exemple #1
0
 partial void DeleteParameterGLFinancialCategory(GRP.BusinessLayer.Automation.Entities.ParameterGLFinancialCategory instance);
Exemple #2
0
        private void DrawImage(Control.MapEditor.DrawType drawType, CImage cImage, float scale, float grpscale)
        {
            if (!mapeditor.view_Unit_StartLoc & cImage.imageID == 588)
            {
                return;
            }
            if (!mapeditor.view_Unit_Maprevealer & cImage.imageID == 582)
            {
                return;
            }



            Vector2 pos = cImage.screen;

            GRP  gRP    = null;
            bool setgrp = false;

            if (cImage.imageID == 588)
            {
                //스타트로케이션
                if (drawType == Control.MapEditor.DrawType.CB)
                {
                    gRP    = GetImageTexture(Control.MapEditor.DrawType.HD, cImage.imageID);
                    setgrp = true;
                }
            }

            if (!setgrp)
            {
                gRP = GetImageTexture(drawType, cImage.imageID);
            }


            if (gRP.frameCount == 0)
            {
                return;
            }
            int frame = cImage.Frame % gRP.frameCount;

            if (cImage.Turnable)
            {
                frame += cImage.turnFrame;
            }


            GRP.FrameData fd = gRP.frameDatas[frame];

            Vector2 p = pos;


            int x = 0, y = 0;

            switch (cImage.imageID)
            {
            case 235:
                break;

            case 251:
                if (drawType != Control.MapEditor.DrawType.CB)
                {
                    x = -8;
                    y = -16;
                }
                break;

            case 254:
                if (drawType != Control.MapEditor.DrawType.CB)
                {
                    x = -8;
                    y = -16;
                }
                break;

            case 588:
                //스타트로케이션
                if (drawType != Control.MapEditor.DrawType.SD)
                {
                    x = -61;
                    y = -32;
                }
                break;

            case 582:
                //맵리빌러
                if (drawType == Control.MapEditor.DrawType.HD)
                {
                    x = -16;
                    y = -16;
                }
                break;
            }


            Vector2 lol       = new Vector2(x, y);
            Vector2 grppos    = new Vector2(fd.xoff, fd.yoff) / grpscale;
            Vector2 grpsize   = new Vector2(gRP.grpwidth, gRP.grpheight) / grpscale / grpscale;
            Vector2 imgpospos = new Vector2(cImage.XOffset, cImage.YOffset);
            Vector2 framesize = new Vector2(fd.fwidth, fd.fheight) / grpscale;



            Vector2 LastPos = new Vector2();

            SpriteEffects spriteEffects = SpriteEffects.None;

            if (cImage.IsLeft)
            {
                spriteEffects = SpriteEffects.FlipHorizontally;

                LastPos.X = grpsize.X / 2 - grppos.X - framesize.X;
                LastPos.Y = grppos.Y - grpsize.Y / 2;

                LastPos += imgpospos + lol;
            }
            else
            {
                LastPos = grppos - grpsize / 2 + imgpospos + lol;
            }



            LastPos *= scale;

            p += LastPos;



            Color color = Color.White;

            bool drawcmp   = false;
            bool nonecolor = false;

            switch (cImage.drawType)
            {
            case CImage.DrawType.Shadow:
                color = new Color(0, 0, 0, 128);
                _spriteBatch.Begin(SpriteSortMode.FrontToBack, blendState: BlendState.NonPremultiplied, samplerState: SamplerState.PointClamp);
                _spriteBatch.Draw(gRP.MainGRP, p, new Rectangle(fd.x, fd.y, fd.fwidth, fd.fheight), color, 0, Vector2.Zero, scale / grpscale, spriteEffects, 1 - cImage.Level / 30f);
                _spriteBatch.End();
                return;

            case CImage.DrawType.Clock:
                color = new Color(255, 255, 255, 64);
                break;

            case CImage.DrawType.Hallaction:
                color     = new Color(64, 64, 255, 255);
                nonecolor = true;
                break;

            case CImage.DrawType.UnitSprite:
                color = Color.White;
                if (mapeditor.view_SpriteColor)
                {
                    color = mapeditor.SpriteOverlay;
                }
                //color = new Color(255, 0, 0, 255);
                break;

            case CImage.DrawType.PureSprite:
                if (mapeditor.view_SpriteColor)
                {
                    color = mapeditor.SpriteOverlay;
                }
                //color = new Color(0, 255, 0, 255);
                break;

            case CImage.DrawType.Doodad:
                if (mapeditor.view_DoodadColor)
                {
                    color = mapeditor.DoodadOverlay;
                }
                //color = new Color(0, 255, 0, 255);
                break;
            }
            if (!drawcmp)
            {
                _spriteBatch.Begin(SpriteSortMode.FrontToBack, blendState: BlendState.NonPremultiplied, samplerState: SamplerState.PointClamp);
                _spriteBatch.Draw(gRP.MainGRP, p, new Rectangle(fd.x, fd.y, fd.fwidth, fd.fheight), color, 0, Vector2.Zero, scale / grpscale, spriteEffects, 1 - cImage.Level / 30f);
            }


            _spriteBatch.End();
            if (!nonecolor)
            {
                if (cImage.color >= 0)
                {
                    if (gRP.Color != null)
                    {
                        Color unitColor = mapeditor.mapdata.UnitColor(cImage.color);

                        if (cImage.drawType == CImage.DrawType.Clock)
                        {
                            unitColor.A = 64;
                        }

                        //BlendState blendState = GraphicsDevice.BlendState;
                        //GraphicsDevice.BlendState = ColorBlend;

                        _colorBatch.Begin(SpriteSortMode.FrontToBack, ColorBlend, samplerState: SamplerState.PointClamp);
                        _colorBatch.Draw(gRP.Color, p, new Rectangle(fd.x, fd.y, fd.fwidth, fd.fheight), unitColor, 0, Vector2.Zero, scale / grpscale, spriteEffects, 1 - cImage.Level / 30f);

                        //GraphicsDevice.BlendState = blendState;

                        _colorBatch.End();
                    }
                }
            }



            _spriteBatch.Begin(blendState: BlendState.NonPremultiplied);

            if (cImage.IsHover | cImage.IsSelect)
            {
                Vector2 rectpos;
                Vector2 rectsize;
                if (cImage.IsUnitRect)
                {
                    rectpos  = pos - new Vector2(cImage.Left, cImage.Up) * scale;
                    rectsize = new Vector2(cImage.Left + cImage.Right, cImage.Up + cImage.Down) * scale;
                }
                else
                {
                    rectpos  = p;
                    rectsize = new Vector2(fd.fwidth, fd.fheight);

                    if (rectsize.LengthSquared() < 8)
                    {
                        rectpos  -= new Vector2(4 * scale);
                        rectsize += new Vector2(8);
                    }


                    rectsize *= scale / grpscale;
                }


                if (cImage.IsHover)
                {
                    _spriteBatch.Draw(gridtexture, new Rectangle((int)rectpos.X, (int)rectpos.Y, (int)rectsize.X, (int)rectsize.Y), null, new Color(128, 128, 255, 48), 0, new Vector2(), SpriteEffects.None, 1);
                    DrawRect(_spriteBatch, rectpos, rectpos + rectsize, Color.Red);
                }
                else if (cImage.IsSelect)
                {
                    _spriteBatch.Draw(gridtexture, new Rectangle((int)rectpos.X, (int)rectpos.Y, (int)rectsize.X, (int)rectsize.Y), null, new Color(128, 255, 128, 48), 0, new Vector2(), SpriteEffects.None, 1);
                    DrawRect(_spriteBatch, rectpos, rectpos + rectsize, Color.Red);
                }
            }
            _spriteBatch.End();
        }
Exemple #3
0
 partial void UpdateParameterActivityType(GRP.BusinessLayer.Automation.Entities.ParameterActivityType instance);
Exemple #4
0
 partial void DeleteParameterEntityType(GRP.BusinessLayer.Automation.Entities.ParameterEntityType instance);
Exemple #5
0
 partial void DeleteReportParameterIncludeGrossNonPayrollExpense(GRP.BusinessLayer.Automation.Entities.ReportParameterIncludeGrossNonPayrollExpense instance);
Exemple #6
0
 partial void DeleteReportParameterReportReceiver(GRP.BusinessLayer.Automation.Entities.ReportParameterReportReceiver instance);
Exemple #7
0
 partial void InsertReport(GRP.BusinessLayer.Automation.Entities.Report instance);
Exemple #8
0
 partial void DeleteReportParameterGLCategorization(GRP.BusinessLayer.Automation.Entities.ReportParameterGLCategorization instance);
Exemple #9
0
 partial void UpdateReportTypeParameter(GRP.BusinessLayer.Automation.Entities.ReportTypeParameter instance);
Exemple #10
0
 partial void UpdateParameterDisplayOverheadBy(GRP.BusinessLayer.Automation.Entities.ParameterDisplayOverheadBy instance);
Exemple #11
0
 partial void InsertParameter(GRP.BusinessLayer.Automation.Entities.Parameter instance);
Exemple #12
0
 partial void DeleteReportParameterPropertyFund(GRP.BusinessLayer.Automation.Entities.ReportParameterPropertyFund instance);
Exemple #13
0
 partial void UpdateParameterGLCategorization(GRP.BusinessLayer.Automation.Entities.ParameterGLCategorization instance);
Exemple #14
0
 /// <summary>
 /// This if the GetFileName version that was made static so that the same behavior can be used in the web and the queue processor
 /// </summary>
 /// <param name="reportType">The report type of the report.</param>
 /// <param name="period">The reporting period for which to generate the report.</param>
 /// <param name="reportName">The report instance name.</param>
 /// <param name="reportGenerationQueueId">The report generation queue id.</param>
 /// <param name="insertedDate">The inserted date of the report generation queue.</param>
 /// <returns>The name that the generated report is to be saved as.</returns>
 public static string GetFileName(GRP.BusinessLayer.Automation.Enums.ReportType reportType, int period, string reportName, int reportGenerationQueueId, DateTime insertedDate)
 {
     return ReportNameFormatterFactory.Instance.Resolve(
         GRP.BusinessLayer.Reporting.Common.EnumHelper.GetName(reportType),
         reportName,
         period,
         reportGenerationQueueId,
         insertedDate).GetFileName();
 }
Exemple #15
0
 partial void UpdateReport(GRP.BusinessLayer.Automation.Entities.Report instance);
Exemple #16
0
 partial void UpdateParameterReportReceiver(GRP.BusinessLayer.Automation.Entities.ParameterReportReceiver instance);
Exemple #17
0
 partial void UpdateReportGenerationQueue(GRP.BusinessLayer.Automation.Entities.ReportGenerationQueue instance);
Exemple #18
0
 partial void DeleteReportParameterGLMinorCategoryActivityType(GRP.BusinessLayer.Automation.Entities.ReportParameterGLMinorCategoryActivityType instance);
Exemple #19
0
 partial void DeleteReportGenerationQueueOutput(GRP.BusinessLayer.Automation.Entities.ReportGenerationQueueOutput instance);
Exemple #20
0
 partial void DeleteReportParameterOriginatingSubRegion(GRP.BusinessLayer.Automation.Entities.ReportParameterOriginatingSubRegion instance);
Exemple #21
0
 partial void InsertReportParameterActivityType(GRP.BusinessLayer.Automation.Entities.ReportParameterActivityType instance);
Exemple #22
0
 partial void DeleteReportType(GRP.BusinessLayer.Automation.Entities.ReportType instance);
Exemple #23
0
 partial void DeleteReportParameterConsolidationRegion(GRP.BusinessLayer.Automation.Entities.ReportParameterConsolidationRegion instance);
Exemple #24
0
 partial void DeleteParameterAllocationSubRegion(GRP.BusinessLayer.Automation.Entities.ParameterAllocationSubRegion instance);
Exemple #25
0
 partial void DeleteReportParameterCurrency(GRP.BusinessLayer.Automation.Entities.ReportParameterCurrency instance);
Exemple #26
0
 partial void DeleteParameterFunctionalDepartment(GRP.BusinessLayer.Automation.Entities.ParameterFunctionalDepartment instance);
Exemple #27
0
 partial void DeleteReportParameterDisplayOverheadBy(GRP.BusinessLayer.Automation.Entities.ReportParameterDisplayOverheadBy instance);
Exemple #28
0
 partial void InsertParameterGLMajorCategory(GRP.BusinessLayer.Automation.Entities.ParameterGLMajorCategory instance);
Exemple #29
0
 partial void UpdateReportParameterDisplayOverheadByOriginatingSubRegion(GRP.BusinessLayer.Automation.Entities.ReportParameterDisplayOverheadByOriginatingSubRegion instance);
Exemple #30
0
        public GRP GetImageTexture(Control.MapEditor.DrawType drawType, int imageindex)
        {
            imageindex = GetImageIndex(imageindex);

            GRP rgrp = GRPDATA[drawType][imageindex];

            float scale;

            if (drawType == Control.MapEditor.DrawType.SD)
            {
                scale = 1;
            }
            else
            {
                scale = 2;
            }

            if (!rgrp.IsLoad)
            {
                //GRP로드가 되지 않았을 경우.
                string fname         = AppDomain.CurrentDomain.BaseDirectory + $"CascData\\{drawType.ToString()}\\anim\\" + imageindex.ToString() + "\\diffuse.png";
                string fcolorname    = AppDomain.CurrentDomain.BaseDirectory + $"CascData\\{drawType.ToString()}\\anim\\" + imageindex.ToString() + "\\teamcolor.png";
                string framedataname = AppDomain.CurrentDomain.BaseDirectory + $"CascData\\{drawType.ToString()}\\anim\\" + imageindex.ToString() + "\\framedata";
                rgrp.GRPFile = fname;
                if (File.Exists(fname))
                {
                    rgrp.MainGRP = LoadFromFile(fname);
                }
                if (File.Exists(fcolorname))
                {
                    rgrp.Color = LoadFromFile(fcolorname);
                }

                if (File.Exists(framedataname))
                {
                    BinaryReader br = new BinaryReader(new MemoryStream(File.ReadAllBytes(framedataname)));

                    rgrp.frameDatas = new GRP.FrameData[br.BaseStream.Length / 16];
                    rgrp.frameCount = br.ReadUInt16();
                    rgrp.grpwidth   = br.ReadUInt16();
                    rgrp.grpheight  = br.ReadUInt16();
                    for (int i = 0; i < rgrp.frameDatas.Length; i++)
                    {
                        GRP.FrameData frameData = new GRP.FrameData();

                        frameData.x       = (short)(br.ReadInt16() / scale);
                        frameData.y       = (short)(br.ReadInt16() / scale);
                        frameData.xoff    = (short)(br.ReadInt16() / scale);
                        frameData.yoff    = (short)(br.ReadInt16() / scale);
                        frameData.fwidth  = (short)(br.ReadInt16() / scale);
                        frameData.fheight = (short)(br.ReadInt16() / scale);
                        frameData.funk1   = (short)(br.ReadInt16() / scale);
                        frameData.funk2   = (short)(br.ReadInt16() / scale);

                        rgrp.frameDatas[i] = frameData;
                    }
                    if (drawType == Control.MapEditor.DrawType.SD)
                    {
                        rgrp.grpwidth  = (ushort)SDGRPSIZE[imageindex].X;
                        rgrp.grpheight = (ushort)SDGRPSIZE[imageindex].Y;
                    }



                    br.Close();
                }


                rgrp.IsLoad = true;
            }



            return(rgrp);
        }
Exemple #31
0
 partial void UpdateReportParameterFunctionalDepartment(GRP.BusinessLayer.Automation.Entities.ReportParameterFunctionalDepartment instance);
 partial void DeleteReforecast(GRP.BusinessLayer.Reporting.Entities.Reforecast instance);
Exemple #33
0
        public static void cobaQuery()
        {
            var db = new Contoh06Context();

            //001 Query biasa

            /*
             *  SELECT T0.*
             *  FROM Invoices T0
             */
            var query001 = from T0 in db.Invoices
                           select T0
            ;

            foreach (var invoice in query001)
            {
                Console.WriteLine($"001 -> {invoice.TransNo}");
            }

            //002 TOP N

            /*
             *  SELECT TOP 1  T0.*
             *  FROM Invoices T0
             */
            var query002 = (from T0 in db.Invoices
                            select T0
                            ).Take(1)
            ;

            foreach (var invoice in query002)
            {
                Console.WriteLine($"002 -> {invoice.TransNo}");
            }


            //003 ORDER BY

            /*
             *  SELECT T0.*
             *  FROM Invoices T0
             *  ORDER BY T0.TransNo ASC
             */
            var query003 = from T0 in db.Invoices
                           orderby T0.TransNo ascending  //descending
                           select T0
            ;

            foreach (var invoice in query003)
            {
                Console.WriteLine($"003 -> {invoice.TransNo}");
            }

            //004 WHERE

            /*
             *  SELECT T0.*
             *  FROM Invoices T0
             *  WHERE T0.TransNo='trans02'
             */
            var query004 = from T0 in db.Invoices
                           where T0.TransNo == "trans02"
                           select T0
            ;

            foreach (var invoice in query004)
            {
                Console.WriteLine($"004 -> {invoice.TransNo}");
            }


            //005 TOP-ORDER-WHERE

            /*
             *  SELECT TOP 1 T0.*
             *  FROM Invoices T0
             *  WHERE T0.TransNo='trans02'
             *  ORDER BY T0.TransNo ASC
             *
             */
            var query005 = (from T0 in db.Invoices
                            orderby T0.TransNo ascending
                            where T0.TransNo == "trans02"
                            select T0
                            ).Take(1)
            ;

            foreach (var invoice in query005)
            {
                Console.WriteLine($"005 -> {invoice.TransNo}");
            }

            //006 Custom Column name

            /*
             *  SELECT TOP 1 T0.TransNo AS NomerInvoice
             *  FROM Invoices T0
             *  WHERE T0.TransNo='trans02'
             *  ORDER BY T0.TransNo ASC
             *
             */
            var query006 = (from T0 in db.Invoices
                            orderby T0.TransNo ascending
                            where T0.TransNo == "trans02"
                            select new
            {
                NomerInvoice = T0.TransNo
            }
                            ).Take(1)
            ;

            foreach (var invoice in query006)
            {
                Console.WriteLine($"006 -> {invoice.NomerInvoice}");
            }

            //007 INNER JOIN

            /*
             *  SELECT TOP 1  T0.TransNo AS NomerInvoice, T1.ItemCode AS KodeBarang
             *  FROM Invoices T0
             *  INNER JOIN InvoiceItems T1 ON T0.Id=T1.Id
             *  WHERE TransNo='trans02'
             *  ORDER BY TransNo ASC
             *
             */
            var query007 = (from T0 in db.Invoices
                            join T1 in db.InvoiceItems on T0.Id equals T1.InvoiceId
                            orderby T0.TransNo ascending
                            where T0.TransNo == "trans02"
                            select new
            {
                NomerInvoice = T0.TransNo,
                KodeBarang = T1.ItemCode
            }
                            ).Take(1)
            ;

            foreach (var invoice in query007)
            {
                Console.WriteLine($"007 -> {invoice.NomerInvoice}-{invoice.KodeBarang}");
            }

            //008 LEFT JOIN -- RIGHT JOIN (tidak mendukung dan kudu di akalin dengan left join

            /*
             *  SELECT TOP 1  T0.TransNo AS NomerInvoice, T1.ItemCode AS KodeBarang
             *  FROM Invoices T0
             *  INNER JOIN InvoiceItems T1 ON T0.Id=T1.Id
             *  WHERE TransNo='trans02'
             *  ORDER BY TransNo ASC
             *
             */
            var query008 = (from T0 in db.Invoices
                            join T1 in db.InvoiceItems on T0.Id equals T1.InvoiceId into J01
                            from T1_0 in J01.DefaultIfEmpty()
                            orderby T0.TransNo ascending
                            where T0.TransNo == "trans02"
                            select new
            {
                NomerInvoice = T0.TransNo,
                KodeBarang = T1_0.ItemCode
            }
                            ).Take(1)
            ;

            foreach (var invoice in query008)
            {
                Console.WriteLine($"008 -> {invoice.NomerInvoice}-{invoice.KodeBarang}");
            }

            //009 CROSS JOIN

            /*
             *  SELECT TOP 1000  T0.TransNo AS NomerInvoice, T1.ItemCode AS KodeBarang
             *  FROM Invoices T0
             *  CROSS JOIN InvoiceItems T1
             *  WHERE TransNo='trans02'
             *  ORDER BY TransNo ASC
             *
             */
            var query009 = (from T0 in db.Invoices
                            from T1 in db.InvoiceItems
                            orderby T0.TransNo ascending
                            where T0.TransNo == "trans02"
                            select new
            {
                NomerInvoice = T0.TransNo,
                KodeBarang = T1.ItemCode
            }
                            ).Take(1000)
            ;

            foreach (var invoice in query009)
            {
                Console.WriteLine($"009 -> {invoice.NomerInvoice}-{invoice.KodeBarang}");
            }


            //010 GROUP BY dengan satu table

            /*
             *  SELECT T0.ItemCode AS KodeBarang , SUM(T0.Qty) AS TotalQty
             *  FROM InvoiceItems T0
             *  GROUP BY T0.ItemCode
             *
             */
            var query010 = from T0 in db.InvoiceItems
                           group T0 by T0.ItemCode into GRP
                           select new
            {
                KodeBarang = GRP.Key,
                TotalQty   = GRP.Sum(x => x.Qty)
            }
            ;

            foreach (var invoice in query010)
            {
                Console.WriteLine($"010 -> {invoice.KodeBarang}-{invoice.TotalQty}");
            }

            //011 GROUP BY dengan inner join

            /*
             *  SELECT  T0.TransNo AS NomerInvoice, T1.ItemCode AS KodeBarang, SUM(T1.Qty) AS TotalQty
             *  FROM Invoices T0
             *  INNER JOIN InvoiceItems T1 ON T0.Id=T1.Id
             *  GROUP BY T0.TransNo, T1.ItemCode
             *
             */
            var query011 = from T0 in db.Invoices
                           join T1 in db.InvoiceItems on T0.Id equals T1.InvoiceId
                           group new { T0, T1 } by new { T0.TransNo, T1.ItemCode } into GRP
                select new
            {
                NomerInvoice = GRP.Key.TransNo,
                KodeBarang   = GRP.Key.ItemCode,
                TotalQty     = GRP.Sum(x => x.T1.Qty)
            }
            ;

            foreach (var invoice in query011)
            {
                Console.WriteLine($"011 -> {invoice.NomerInvoice}-{invoice.KodeBarang}-{invoice.TotalQty}");
            }

            //012 HAVING

            /*
             *  SELECT  T0.TransNo AS NomerInvoice, T1.ItemCode AS KodeBarang, SUM(T0.Qty) AS TotalQty
             *  FROM Invoices T0
             *  INNER JOIN InvoiceItems T1 ON T0.Id=T1.Id
             *  GROUP BY T0.TransNo, T1.ItemCode
             *  HAVING  SUM(T0.Qty)>2
             *
             */
            var query012 = from T0 in db.Invoices
                           join T1 in db.InvoiceItems on T0.Id equals T1.InvoiceId
                           group new { T0, T1 } by new { T0.TransNo, T1.ItemCode } into GRP
            where GRP.Sum(x => x.T1.Qty) > 2
            select new
            {
                NomerInvoice = GRP.Key.TransNo,
                KodeBarang   = GRP.Key.ItemCode,
                TotalQty     = GRP.Sum(x => x.T1.Qty)
            }
            ;

            foreach (var invoice in query012)
            {
                Console.WriteLine($"012 -> {invoice.NomerInvoice}-{invoice.KodeBarang}-{invoice.TotalQty}");
            }

            //013 HAVING--WHERE--ORDERBY

            /*
             *  SELECT  T0.TransNo AS NomerInvoice, T1.ItemCode AS KodeBarang, SUM(T1.Qty) AS TotalQty
             *  FROM Invoices T0
             *  INNER JOIN InvoiceItems T1 ON T0.Id=T1.Id
             *  WHERE T0.TransNo='trans02'
             *  GROUP BY T0.TransNo, T1.ItemCode
             *  HAVING  SUM(T1.Qty)>2
             *  ORDER BY T1.ItemCode DESC
             *
             */
            var query013 = (
                from T0 in db.Invoices
                join T1 in db.InvoiceItems on T0.Id equals T1.InvoiceId
                where T0.TransNo == "trans02"
                group new { T0, T1 } by new { T0.TransNo, T1.ItemCode } into GRP
                where GRP.Sum(x => x.T1.Qty) > 2
                orderby GRP.Key.ItemCode descending
                select new
            {
                NomerInvoice = GRP.Key.TransNo,
                KodeBarang = GRP.Key.ItemCode,
                TotalQty = GRP.Sum(x => x.T1.Qty)
            }
                ).Take(2)
                           //kalau di taruh di sini akan jadi sub query
                           //.OrderBy(p => p.KodeBarang )
                           //.OrderByDescending(p => p.KodeBarang)
            ;

            //foreach (var invoice in query013)
            //{
            //    Console.WriteLine($"013 -> {invoice.NomerInvoice}-{invoice.KodeBarang}-{invoice.TotalQty}");
            //}

            //013 HAVING--WHERE--ORDERBY--CASE

            /*
             *  SELECT  T0.TransNo AS NomerInvoice, T1.ItemCode AS KodeBarang, SUM(CASE WHEN T1.Qty<1 THEN 0 ELSE T1.Qty END) AS TotalQty
             *  FROM Invoices T0
             *  INNER JOIN InvoiceItems T1 ON T0.Id=T1.Id
             *  WHERE T0.TransNo='trans02'
             *  GROUP BY T0.TransNo, T1.ItemCode
             *  HAVING  SUM(CASE WHEN T1.Qty<1 THEN 0 ELSE T1.Qty END)>0
             *  ORDER BY T1.ItemCode DESC
             *
             */
            var query014 = (
                from T0 in db.Invoices
                join T1 in db.InvoiceItems on T0.Id equals T1.InvoiceId
                where T0.TransNo == "trans02"
                group new { T0, T1 } by new { T0.TransNo, T1.ItemCode } into GRP
                where GRP.Sum(x => x.T1.Qty < 2 ? 0 : x.T1.Qty) > 0
                orderby GRP.Key.ItemCode descending
                select new
            {
                NomerInvoice = GRP.Key.TransNo,
                KodeBarang = GRP.Key.ItemCode,
                TotalQty = GRP.Sum(x => x.T1.Qty < 2 ? 0 : x.T1.Qty)
            }

                ).Take(2)
            ;

            foreach (var invoice in query014)
            {
                Console.WriteLine($"014 -> {invoice.NomerInvoice}-{invoice.KodeBarang}-{invoice.TotalQty}");
            }

            Console.WriteLine("END YA");
        }