Пример #1
0
 private void frmstkGoodSaleOutStock_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         //按ESC退出
         if (e.KeyCode == Keys.Escape)
         {
             this.Close();
         }
         //销售员
         else if (e.KeyCode == Keys.F1)
         {
             lkpsUserID.Focus();
         }
         //会员卡
         else if (e.KeyCode == Keys.F2)
         {
             txtsVipCardNo.Focus();
         }
         //收款结账
         else if (e.KeyCode == Keys.ShiftKey)
         {
             if (gvDetail.RowCount > 0)
             {
                 //去除最后的空行
                 gvDetail.MoveLast();
                 if (gvDetail.GetFocusedDataRow()["sGoodID"].ToString() == "")
                 {
                     gvDetail.DeleteRow(gvDetail.FocusedRowHandle);
                 }
                 gvDetail.Columns["fAmount"].SummaryItem.SetSummary(DevExpress.Data.SummaryItemType.Sum, "{0:0.00}");
                 ((DataRowView)bdsMain.Current).Row["fSaleAmount"] = gvDetail.Columns["fAmount"].SummaryItem.SummaryValue;
                 if (gvDetail.RowCount > 0)
                 {
                     frmstkGoodSaleOutStockCheckOut frm = new frmstkGoodSaleOutStockCheckOut(gvDetail.Columns["fAmount"].SummaryItem.SummaryValue.ToString());
                     if (frm.ShowDialog() == DialogResult.OK)
                     {
                         ((DataRowView)bdsMain.Current).Row["fPayMoney"] = frm.fPayMoney;
                         bdsMain.EndEdit();
                         //先打印收银条再保存单据
                         PrintBill();
                         //保存,不显示保存提示
                         ShowSaveInfo = false;
                         btnSave_Click(sender, null);
                         //保存以后再自动新增
                         btnAdd_Click(sender, null);
                     }
                 }
             }
         }
         //删除交易明细
         else if (e.KeyCode == Keys.Delete)
         {
             if (gvDetail.FocusedRowHandle >= 0)
             {
                 gvDetail.DeleteRow(gvDetail.FocusedRowHandle);
             }
         }
         else if (e.KeyCode == Keys.F12)
         {
             if (gvDetail.RowCount > 0)
             {
                 LDetailDataSet[LDetailDALName.IndexOf("stkGoodOutStockDetailDAL")].Tables[0].Clear();
             }
         }
     }
     catch (Exception)
     {
     }
 }
 private void frmstkGoodSaleOutStock_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         //按ESC退出
         if (e.KeyCode == Keys.Escape)
         {
             this.Close();
         }
         //销售员
         else if (e.KeyCode == Keys.F1)
         {
             lkpsUserID.Focus();
         }
         //会员卡
         else if (e.KeyCode == Keys.F2)
         {
             txtsVipCardNo.Focus();
         }
         //收款结账
         else if (e.KeyCode == Keys.ShiftKey)
         {
             if (gvDetail.RowCount > 0)
             {
                 //去除最后的空行
                 gvDetail.MoveLast();
                 if (gvDetail.GetFocusedDataRow()["sGoodID"].ToString() == "")
                 {
                     gvDetail.DeleteRow(gvDetail.FocusedRowHandle);
                 }
                 gvDetail.Columns["fAmount"].SummaryItem.SetSummary(DevExpress.Data.SummaryItemType.Sum, "{0:0.00}");
                 ((DataRowView)bdsMain.Current).Row["fSaleAmount"] = gvDetail.Columns["fAmount"].SummaryItem.SummaryValue;
                 if (gvDetail.RowCount > 0)
                 {
                     frmstkGoodSaleOutStockCheckOut frm = new frmstkGoodSaleOutStockCheckOut(gvDetail.Columns["fAmount"].SummaryItem.SummaryValue.ToString());
                     if (frm.ShowDialog() == DialogResult.OK)
                     {
                         ((DataRowView)bdsMain.Current).Row["fPayMoney"] = frm.fPayMoney;
                         bdsMain.EndEdit();
                         //先打印收银条再保存单据
                         PrintBill();
                         //保存,不显示保存提示
                         ShowSaveInfo = false;
                         btnSave_Click(sender, null);
                         //保存以后再自动新增
                         btnAdd_Click(sender, null);
                     }
                 }
             }
         }
             //删除交易明细
         else if (e.KeyCode == Keys.Delete)
         {
             if (gvDetail.FocusedRowHandle >= 0)
             {
                 gvDetail.DeleteRow(gvDetail.FocusedRowHandle);
             }
         }
         else if (e.KeyCode == Keys.F12)
         {
             if (gvDetail.RowCount > 0)
             {
                 LDetailDataSet[LDetailDALName.IndexOf("stkGoodOutStockDetailDAL")].Tables[0].Clear();
             }
         }
     }
     catch (Exception)
     {
     }
 }