示例#1
0
        /// <summary>
        /// 向上查找输入的信息
        /// </summary>
        private void btnPrevious_Click(object sender, EventArgs e)
        {
            try
            {
                if (textContent.Text.Trim() == "")
                {
                    return;
                }
                int locationRowNo    = browseXtraGridView.FocusedRowHandle;
                int locationColumnNo = browseXtraGridView.FocusedColumn.AbsoluteIndex;

                textContent.Focus();
                browseXtraGridView.Focus();
                for (int i = locationRowNo; i >= 0; i--)
                {
                    for (int j = locationColumnNo - 1; j >= 0; j--)
                    {
                        if (!browseXtraGridView.Columns[j].Visible)
                        {
                            continue;
                        }
                        string cellValue = DataTypeConvert.GetString(browseXtraGridView.GetRowCellDisplayText(i, browseXtraGridView.Columns[j]));
                        if (cellValue.Contains(textContent.Text.Trim()))
                        {
                            browseXtraGridView.FocusedRowHandle = i;
                            browseXtraGridView.FocusedColumn    = browseXtraGridView.Columns[j];

                            GridViewInfo    vi       = browseXtraGridView.GetViewInfo() as GridViewInfo;
                            GridDataRowInfo rowInfo  = vi.RowsInfo.GetInfoByHandle(i) as GridDataRowInfo;
                            GridCellInfo    cellInfo = rowInfo.Cells[0];
                            if (cellInfo != null)
                            {
                                cellInfo.State = GridRowCellState.FocusedCell;
                            }
                            return;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    locationColumnNo = browseXtraGridView.Columns.Count;
                }
            }
            catch (Exception ex)
            {
                //ExceptionHandler.HandleException(this.Text + "--向上查找输入的信息错误。", ex);
                ExceptionHandler.HandleException(this.Text + "--" + f.tsmiXsczsrdxxcw.Text, ex);
            }
        }
示例#2
0
        private void gridView3_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            GridView view = sender as GridView;

            if (view == null)
            {
                return;
            }

            if (e.RowHandle != view.FocusedRowHandle)
            {
                DevExpress.XtraGrid.Views.Grid.GridView View = sender as GridView;
                string err = View.GetRowCellDisplayText(e.RowHandle, View.Columns["large_name"]);
                if (err == "합계")//Cell의 값이 APPLE인 경우 Cell색 변경
                {
                    e.Appearance.BackColor  = Color.Cornsilk;
                    e.Appearance.BackColor2 = Color.Cornsilk; //그라데이션 처리
                }
                else if (err == "총계")
                {
                    {
                        e.Appearance.BackColor  = Color.Ivory;
                        e.Appearance.BackColor2 = Color.Ivory; //그라데이션 처리
                    }
                }
            }
        }
示例#3
0
        private void advBandedGridView1_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            //if (e.RowHandle >= 0)
            //{
            //    DevExpress.XtraGrid.Views.Grid.GridView View = sender as GridView;
            //    string err = View.GetRowCellDisplayText(e.RowHandle, View.Columns["check_memo"]);
            //    if (err != "Y")
            //    {
            //        e.Appearance.BackColor = Color.YellowGreen;
            //        e.Appearance.BackColor2 = Color.White;
            //    }
            //}
            //---------------------------------------------------------------------------
            GridView view = sender as GridView;

            if (view == null)
            {
                return;
            }

            if (e.RowHandle != view.FocusedRowHandle)
            {
                DevExpress.XtraGrid.Views.Grid.GridView View = sender as GridView;
                string err = View.GetRowCellDisplayText(e.RowHandle, View.Columns["check_memo"]);
                if (err != "Y")//Cell의 값이 APPLE인 경우 Cell색 변경
                {
                    e.Appearance.BackColor  = Color.YellowGreen;
                    e.Appearance.BackColor2 = Color.White; //그라데이션 처리
                }
            }
        }
示例#4
0
        //public static Boolean ConvertirPDF()
        //{
        //    string pdfpath = "C:\\Salva Documentos\\Promowork";
        //    string imagepath = "C:\\Salva Documentos\\Promowork";
        //    Document doc = new Document();
        //    try
        //    {

        //        PdfWriter.GetInstance(doc, new FileStream(pdfpath + "\\Images.pdf", FileMode.Create));
        //        doc.Open();

        //        doc.Add(new Paragraph("GIF"));
        //        Image gif = Image.GetInstance(imagepath + "\\Prueba.gif");
        //        doc.Add(gif);
        //    }
        //    catch (Exception ex)
        //    {
        //        //Log error;
        //    }
        //    finally
        //    {
        //        doc.Close();
        //    }

        //    return true;
        //}

        #region RECUENTO, SUMA Y PROMEDIO DE CELDAS
        public static resultadoCeldasSeleccionadas SumarCeldas(DevExpress.XtraGrid.Views.Grid.GridView gridView, GridCell[] celdasSeleccionadas)
        {
            resultadoCeldasSeleccionadas resultado = new resultadoCeldasSeleccionadas();

            double importeTotal = 0;

            for (int i = 0; i < celdasSeleccionadas.Count(); i++)
            {
                double importeCel = 0;
                double.TryParse(gridView.GetRowCellDisplayText(celdasSeleccionadas[i].RowHandle, celdasSeleccionadas[i].Column).Replace("€", ""), out importeCel);
                importeTotal = importeTotal + importeCel;
            }

            resultado.Recuento = celdasSeleccionadas.Count();
            resultado.Suma     = importeTotal;
            resultado.Promedio = importeTotal / celdasSeleccionadas.Count();


            return(resultado);
        }
示例#5
0
 private void gridView1_RowStyle(object sender, RowStyleEventArgs e)
 {
     DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
     if (e.RowHandle >= 0)
     {
         string category = view.GetRowCellDisplayText(e.RowHandle, view.Columns["项目状态"]);
         if (category == "成功")
         {
             e.Appearance.BackColor = Color.LightGreen;
             //e.Appearance.BackColor2 = Color.SeaShell;
         }
         else if (category == "暂停")
         {
             e.Appearance.BackColor = Color.Coral;
             //e.Appearance.BackColor2 = Color.SeaShell;
         }
         else if (category == "完成")
         {
             e.Appearance.BackColor = Color.LightGray;
             //e.Appearance.BackColor2 = Color.SeaShell;
         }
     }
 }
示例#6
0
        public void changetabpndc(ListView lvinfo, ListView lvuser, DevExpress.XtraGrid.Views.Grid.GridView view, string tsbt)
        {
            try
            {
                view.OptionsView.ColumnAutoWidth = true;
                lvinfo.Clear();
                DataTable da   = new DataTable();
                string    info = view.GetRowCellValue(view.FocusedRowHandle, "ID").ToString();
                lvinfo.Columns.Add("", 180);
                lvinfo.Columns.Add("", 300);
                lvinfo.View = View.Details;
                if (tsbt == "tsbtpndc")
                {
                    da = gen.GetTable("select AccountingObjectCode,a.Contactname,JournalMemo,DocumentIncluded,RefDate,PostedDate,RefNo,StockCode,Posted,AccountingObjectType,Cancel,StockName  from INReInward a, AccountingObject b,Stock c where a.AccountingObjectID=b.AccountingObjectID and a.StockID=c.StockID and RefID='" + info + "'");
                }
                else if (tsbt == "tsbtptnhvt")
                {
                    da = gen.GetTable("select AccountingObjectCode,a.Contactname,JournalMemo,DocumentIncluded,RefDate,PostedDate,RefNo,StockCode,Posted,AccountingObjectType,Cancel,StockName  from SUBADeposit a, AccountingObject b,Stock c where a.AccountingObjectID=b.AccountingObjectID and a.StockID=c.StockID and RefID='" + info + "'");
                }
                else if (tsbt == "tsbtpctmvt")
                {
                    da = gen.GetTable("select AccountingObjectCode,a.Contactname,JournalMemo,DocumentIncluded,RefDate,PostedDate,RefNo,StockCode,Posted,AccountingObjectType,Cancel,StockName  from SUCAPayment a, AccountingObject b,Stock c where a.AccountingObjectID=b.AccountingObjectID and a.StockID=c.StockID and RefID='" + info + "'");
                }
                else if (tsbt == "tsbtpcnhvt")
                {
                    da = gen.GetTable("select AccountingObjectCode,a.Contactname,JournalMemo,DocumentIncluded,RefDate,PostedDate,RefNo,StockCode,Posted,AccountingObjectType,Cancel,StockName  from SUBATransfer a, AccountingObject b,Stock c where a.AccountingObjectID=b.AccountingObjectID and a.StockID=c.StockID and RefID='" + info + "'");
                }
                ListViewItem item1;
                item1 = new ListViewItem("Số chứng từ");
                item1.SubItems.Add(da.Rows[0][6].ToString());
                lvinfo.Items.Add(item1);
                item1 = new ListViewItem("Ngày chứng từ");
                string   ng;
                DateTime ngay;
                ngay = DateTime.Parse(da.Rows[0][4].ToString());
                ng   = String.Format("{0:dd/MM/yyyy}", ngay);
                item1.SubItems.Add(ng);
                lvinfo.Items.Add(item1);
                item1 = new ListViewItem("Ngày hạch toán");
                ngay  = DateTime.Parse(da.Rows[0][5].ToString());
                ng    = String.Format("{0:dd/MM/yyyy}", ngay);
                item1.SubItems.Add(ng);
                lvinfo.Items.Add(item1);
                item1 = new ListViewItem("Kho");
                item1.SubItems.Add(da.Rows[0][7].ToString() + " - " + da.Rows[0][11].ToString());
                lvinfo.Items.Add(item1);
                item1 = new ListViewItem("Đối tượng");
                item1.SubItems.Add(da.Rows[0][0].ToString());
                lvinfo.Items.Add(item1);
                item1 = new ListViewItem("Người nộp");
                item1.SubItems.Add(da.Rows[0][1].ToString());
                lvinfo.Items.Add(item1);
                item1 = new ListViewItem("Lý do nộp");
                item1.SubItems.Add(da.Rows[0][2].ToString());
                lvinfo.Items.Add(item1);
                item1 = new ListViewItem("Chứng từ gốc");
                item1.SubItems.Add(da.Rows[0][3].ToString());
                lvinfo.Items.Add(item1);
                item1 = new ListViewItem("Số tiền");
                item1.SubItems.Add(view.GetRowCellDisplayText(view.FocusedRowHandle, "Số tiền").ToString());
                lvinfo.Items.Add(item1);
                gen.ResizeListViewColumns(lvuser);

                lvuser.Clear();
                lvuser.Columns.Add("Tài khoản có", 180);
                lvuser.Columns.Add("Tài khoản nợ", 180);
                lvuser.Columns.Add("Mã hàng", 180);
                lvuser.Columns.Add("Số lượng ", 180);
                lvuser.Columns.Add("Đơn giá", 180);
                lvuser.Columns.Add("Thành tiền", 180);
                lvuser.View = View.Details;
                if (tsbt == "tsbtpndc")
                {
                    da = gen.GetTable("select  a.Description,DebitAccount,CreditAccount,Amount,InventoryItemName,Quantity,a.SalePrice,InventoryItemCode from INReInwardDetail a,InventoryItem b where a.InventoryItemID=b.InventoryItemID and RefID='" + info + "' order by SortOrder");
                }
                else if (tsbt == "tsbtptnhvt")
                {
                    da = gen.GetTable("select  a.Description,DebitAccount,CreditAccount,Amount,InventoryItemName,Quantity,a.SalePrice,InventoryItemCode from SUBADepositDetail a,InventoryItem b where a.InventoryItemID=b.InventoryItemID and RefID='" + info + "' order by SortOrder");
                }
                else if (tsbt == "tsbtpctmvt")
                {
                    da = gen.GetTable("select  a.Description,DebitAccount,CreditAccount,Amount,InventoryItemName,Quantity,a.SalePrice,InventoryItemCode from SUCAPaymentDetail a,InventoryItem b where a.InventoryItemID=b.InventoryItemID and RefID='" + info + "' order by SortOrder");
                }
                else if (tsbt == "tsbtpcnhvt")
                {
                    da = gen.GetTable("select  a.Description,DebitAccount,CreditAccount,Amount,InventoryItemName,Quantity,a.SalePrice,InventoryItemCode from SUBATransferDetail a,InventoryItem b where a.InventoryItemID=b.InventoryItemID and RefID='" + info + "' order by SortOrder");
                }
                ListViewItem item2;
                for (int i = 0; i < da.Rows.Count; i++)
                {
                    item2 = new ListViewItem(da.Rows[i][2].ToString());
                    item2.SubItems.Add(da.Rows[i][1].ToString());
                    item2.SubItems.Add(da.Rows[i][7].ToString() + " - " + da.Rows[i][4].ToString());
                    item2.SubItems.Add(String.Format("{0:n0}", Double.Parse(da.Rows[i][5].ToString())));
                    item2.SubItems.Add(String.Format("{0:n0}", Double.Parse(da.Rows[i][6].ToString())));
                    item2.SubItems.Add(String.Format("{0:n0}", Double.Parse(da.Rows[i][3].ToString())));
                    lvuser.Items.Add(item2);
                }
                lvuser.Columns[3].TextAlign = HorizontalAlignment.Right;
                lvuser.Columns[4].TextAlign = HorizontalAlignment.Right;
                gen.ResizeListViewColumns(lvuser);
            }
            catch
            {
                lvinfo.Clear();
                lvuser.Clear();
            }
        }