Beispiel #1
0
        private void rpt3_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            if (StoreName != null)
            {
                xrLabel3.Text = StoreName;
            }

            string _Date = "";

            if (ParamDate.Count == 2)
            {
                _Date = ParamDate[0].date.ToShortDateString() + " to " + ParamDate[1].date.ToShortDateString();
            }
            else
            {
                for (int i = 0; i < ParamDate.Count; i++)
                {
                    _Date += Helpers.ConvertMyDate(ParamDate[i].date) + (i == ParamDate.Count - 1 ? "" : ", ");
                }
            }
            xrLabel2.Text = "Report generated with date range of " + _Date;

            //FindControl("xrLabel21", true).DataBindings.Add("Text", this.DataSource, "Name");
            //FindControl("xrLabel22", true).DataBindings.Add("Text", this.DataSource, "Quantity");
            //FindControl("xrLabel23", true).DataBindings.Add("Text", this.DataSource, "Amount");
            //FindControl("xrLabel24", true).DataBindings.Add("Text", this.DataSource, "Percent", "{0:p}");
            //FindControl("xrLabel25", true).DataBindings.Add("Text", this.DataSource, "Average", "{0:#,##0.00}");

            xrLabel15.DataBindings.Add("Text", this.DataSource, "Name");
            xrLabel16.DataBindings.Add("Text", this.DataSource, "Quantity", "{0:#,##0}");
            xrLabel17.DataBindings.Add("Text", this.DataSource, "Amount", "{0:#,##0.00}");
            xrLabel18.DataBindings.Add("Text", this.DataSource, "Percent", "{0:p}");

            //totals ----------
            XRLabel lblTotalQty = xrLabel10;

            lblTotalQty.Text = TotalQty.ToString("#,##0.00");

            XRLabel lblTotalAmt = xrLabel11;

            lblTotalAmt.Text = TotalAmt.ToString("#,##0.00");

            XRLabel lblTotalPercent = xrLabel14;

            lblTotalPercent.Text = TotalPercent.ToString("#,##0.00");

            //other calculations ----------
            //Discount Total
            XRLabel lblDiscntTotalAmt = xrLabel13;

            lblDiscntTotalAmt.Text = DiscountAmt.ToString("#,##0.00");

            //Net Sales
            XRLabel lblNetSales = xrLabel7;

            lblNetSales.Text = (Convert.ToDouble(lblTotalAmt.Text) - Convert.ToDouble(lblDiscntTotalAmt.Text)).ToString("#,##0.00");
        }
Beispiel #2
0
        private void SetDefaultValues()
        {
            try
            {
                var defaultMembers = from lines in Tables.Lines
                                     where lines.Description == Line && lines.Department == Department
                                     select lines;
                var dm = defaultMembers.FirstOrDefault().Members;
                decimal.TryParse(dm.ToString(), out var members);
                numericUpDown1.Value  = members;
                dateTimePicker1.Value = DateTimes;

                Text = Order + " - " + Line;

                if (Text == string.Empty)
                {
                    Text = "Programmation options";
                }

                lblCommessaBox.Text = Order;
                lblArtBox.Text      = Article;
                lblQtyBox.Text      = TotalQty.ToString();
                lblCaricoSugg.Text  = "Carico: " + Carico.ToString();

                if (Carico == 0)
                {
                    checkBox1.Enabled = false;
                    checkBox1.Checked = true;
                    ByTotalQty        = true;
                }
                else
                {
                    checkBox1.Checked = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }