From 8be15d2d33f0964cea4740d231f6ccb61b3f3816 Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Sun, 8 Dec 2013 02:44:31 +0530 Subject: [PATCH] Fixed: Error in ProductsBI Added: Copy to clipboard in SaleAnalysis/Detail --- Tanshu.Accounts.BI/ProductBI.cs | 2 +- .../Sales/SaleAnalysisForm.cs | 12 ++++++++++++ .../Sales/SaleAnalysisForm.designer.cs | 15 ++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Tanshu.Accounts.BI/ProductBI.cs b/Tanshu.Accounts.BI/ProductBI.cs index b33b77f..ac7cc30 100644 --- a/Tanshu.Accounts.BI/ProductBI.cs +++ b/Tanshu.Accounts.BI/ProductBI.cs @@ -101,7 +101,7 @@ namespace Tanshu.Accounts.BI { Dictionary filter = new Dictionary(); filter.Add("Name", ""); - filter.Add("Type", ""); + filter.Add("ProductGroup", ""); return GetFilteredProducts(filter); } public List GetProductGroups() diff --git a/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs b/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs index 87e004d..f342e42 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs +++ b/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.cs @@ -91,5 +91,17 @@ namespace Tanshu.Accounts.PointOfSale Print.Thermal.PrintSale(_analysisDetail, startDate, finishDate); } } + + private void btnCopy_Click(object sender, EventArgs e) + { + if (_analysisDetail == null) + return; + var data = string.Format("{0}\t{1}\t{2}\t{3}\n", "Group", "Product", "Quantity", "Amount"); + foreach (var item in _analysisDetail) + { + data += string.Format("{0}\t{1}\t{2}\t{3}\n", item.Section, item.Product, item.Quantity, item.Amount); + } + Clipboard.SetText(data, TextDataFormat.Text); + } } } diff --git a/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.designer.cs b/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.designer.cs index 29f0614..b50abab 100644 --- a/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.designer.cs +++ b/Tanshu.Accounts.PointOfSale/Sales/SaleAnalysisForm.designer.cs @@ -35,6 +35,7 @@ this.dtpStart = new System.Windows.Forms.DateTimePicker(); this.label10 = new System.Windows.Forms.Label(); this.btnPrint = new System.Windows.Forms.Button(); + this.btnCopy = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dgvSale)).BeginInit(); this.SuspendLayout(); // @@ -108,15 +109,26 @@ this.btnPrint.Name = "btnPrint"; this.btnPrint.Size = new System.Drawing.Size(75, 23); this.btnPrint.TabIndex = 28; - this.btnPrint.Text = "Print"; + this.btnPrint.Text = "&Print"; this.btnPrint.UseVisualStyleBackColor = true; this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click); // + // btnCopy + // + this.btnCopy.Location = new System.Drawing.Point(380, 12); + this.btnCopy.Name = "btnCopy"; + this.btnCopy.Size = new System.Drawing.Size(75, 23); + this.btnCopy.TabIndex = 29; + this.btnCopy.Text = "&Copy"; + this.btnCopy.UseVisualStyleBackColor = true; + this.btnCopy.Click += new System.EventHandler(this.btnCopy_Click); + // // frmSaleAnalysisForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(548, 519); + this.Controls.Add(this.btnCopy); this.Controls.Add(this.btnPrint); this.Controls.Add(this.txtFreeSale); this.Controls.Add(this.label4); @@ -144,5 +156,6 @@ private System.Windows.Forms.DateTimePicker dtpStart; private System.Windows.Forms.Label label10; private System.Windows.Forms.Button btnPrint; + private System.Windows.Forms.Button btnCopy; } } \ No newline at end of file