Esempio n. 1
0
 void lbKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && ((ListBox)sender).SelectedIndex > -1)
     {
         string sDate = lbSalesDate.Items[((ListBox)sender).SelectedIndex].ToString();
         if (sDate != "N/A")
         {
             sDate = sDate.Replace("/", "");
             if (!bAlternateEngine)
             {
                 frmTillTransactions ftt = new frmTillTransactions(ref sEngine, Convert.ToInt32(sTillCodes[lbTills.SelectedIndex]), sDate);
                 ftt.ShowDialog();
             }
             else
             {
                 frmTillTransactions ftt = new frmTillTransactions(ref sOtherEngine, Convert.ToInt32(sTillCodes[lbTills.SelectedIndex]), sDate);
                 ftt.ShowDialog();
             }
         }
     }
     else if (e.KeyCode == Keys.Escape)
     {
         if (lbTills.Items.Count > 1)
         {
             lbTills.Focus();
             lbDays.SelectedIndex = -1;
         }
         else
         {
             this.Close();
         }
     }
     else if (e.KeyCode == Keys.F5)
     {
         // Change Date
         frmReportDates frd = new frmReportDates(Period.Weekly);
         frd.ShowDialog();
         if (frd.SelectedFolder != "$NONE")
         {
             sOtherEngine     = new StockEngine(frd.SelectedFolder);
             bAlternateEngine = true;
             DisplaySalesInfo();
             lbDays.Focus();
         }
     }
 }
 void lbSales_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         this.Close();
     }
     else if (e.KeyCode == Keys.Enter)
     {
         if (lbSales.Items.Count > 0)
         {
             string sDay = sEngine.WorkOutDateOfSale(sTranNo[lbSales.SelectedIndex], sSalesDate[lbSales.SelectedIndex]);
             BackOffice.Database_Engine.Table t = new BackOffice.Database_Engine.Table("Archive\\Weekly\\" + sSalesDate[lbSales.SelectedIndex] + "\\TILL1\\INGNG\\REPDATA" + sDay + ".DBF");
             string sDate = t.GetRecordFrom(0)[1];
             if (sDay == "ERROR")
             {
                 throw new NotImplementedException("Barcode : " + sBarcode + ", TranNo : " + sTranNo[lbSales.SelectedIndex]);
             }
             StockEngine         s   = new StockEngine("Archive\\Weekly\\" + sSalesDate[lbSales.SelectedIndex]);
             frmTillTransactions ftt = new frmTillTransactions(ref s, 1, sDate.Replace("/", ""));
             ftt.Show();
             ftt.SelectATransaction(sTranNo[lbSales.SelectedIndex]);
         }
     }
 }