private void btnPreview_Click(object sender, EventArgs e)
{
DateTime dttt;
DateTime dt = Convert.ToDateTime(dtpFrom.Text);
DateTime dt1 = Convert.ToDateTime(dtpTo.Text);
TimeSpan ts = dt - dt1;
int ii = ts.Days;
for (int i = 0; i <ii ; i++)
{
fnInvoiceSaveUpdate(block, dttt);
DateTime dtn = Convert.ToDateTime(dtpFrom.Text);
DateTime dttt = dtn.AddDays(i);
}
frmExpenseDetailsPrint objfrmExpenseDetailsPrint = new frmExpenseDetailsPrint();
objfrmExpenseDetailsPrint.FromDate = dtpFrom.Value;
objfrmExpenseDetailsPrint.ToDate = dtpTo.Value;
objfrmExpenseDetailsPrint.iAccID = G_iAccountID;
objfrmExpenseDetailsPrint.iItemID = G_iItemID;
//objfrmExpenseDetailsPrint.dtpInvoive = dtp.
objfrmExpenseDetailsPrint.Show();
}
private string fnInvoiceSaveUpdate(int Block,DateTime invoDate)
{
string ReturnValue = "";
try
{
int G_iTeaQty = 0;
int G_iTeaTotal = 0;
int G_iCoffeeQty = 0;
int G_iCoffeeTotal = 0;
int G_iSoftQty = 0;
int G_iSoftTotal = 0;
int G_iMineralQty = 0;
int G_iMineralTotal = 0;
int G_iPhotoQty = 0;
int G_iPhotoTotal = 0;
int G_iFaxQty = 0;
int G_iFaxTotal = 0;
int G_iGenQty = 0;
int G_iGenTotal = 0;
int G_iMiscallaQty = 0;
int G_iMiscallaTotal = 0;
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = new SqlCommand("PrcInvoiceReportPrint", ClsConnect.conSql);
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
sda.SelectCommand.Parameters.AddWithValue("@iSalesID", G_InvID);
sda.SelectCommand.Parameters.AddWithValue("@iAccID", G_iAccountID);
sda.SelectCommand.Parameters.AddWithValue("@FromDate", FromDate);
sda.SelectCommand.Parameters.AddWithValue("@ToDate", ToDate);
sda.SelectCommand.Parameters.AddWithValue("@iItemID", G_iItemID);
sda.SelectCommand.Parameters.AddWithValue("@iTeaQty", G_iTeaQty);
sda.SelectCommand.Parameters.AddWithValue("@iTeaTotal", G_iTeaTotal);
sda.SelectCommand.Parameters.AddWithValue("@iCoffeeQty", G_iCoffeeQty);
sda.SelectCommand.Parameters.AddWithValue("@iCoffeeTotal", G_iCoffeeTotal);
sda.SelectCommand.Parameters.AddWithValue("@iSoftQty", G_iSoftQty);
sda.SelectCommand.Parameters.AddWithValue("@iSoftTotal", G_iSoftTotal);
sda.SelectCommand.Parameters.AddWithValue("@iMineralQty", G_iMineralQty);
sda.SelectCommand.Parameters.AddWithValue("@iMineralTotal", G_iMineralTotal);
sda.SelectCommand.Parameters.AddWithValue("@iPhotoQty", G_iPhotoQty);
sda.SelectCommand.Parameters.AddWithValue("@iPhotoTotal", G_iPhotoTotal);
sda.SelectCommand.Parameters.AddWithValue("@iFaxQty", G_iFaxQty);
sda.SelectCommand.Parameters.AddWithValue("@iFaxTotal", G_iFaxTotal);
sda.SelectCommand.Parameters.AddWithValue("@iGenQty", G_iGenQty);
sda.SelectCommand.Parameters.AddWithValue("@iGenTotal", G_iGenTotal);
sda.SelectCommand.Parameters.AddWithValue("@iMiscallaQty", G_iMiscallaQty);
sda.SelectCommand.Parameters.AddWithValue("@iMiscallaTotal", G_iMiscallaTotal);
//sda.SelectCommand.Parameters.AddWithValue("@dInvoiceDate", InvDate.ToString("MM/dd/yyyy"));
//sda.SelectCommand.Parameters.AddWithValue("@iSerialNo", txtSerialNo.Text);
//sda.SelectCommand.Parameters.AddWithValue("@deTotAmount", AmountTotal);
//sda.SelectCommand.Parameters.AddWithValue("@deRate", txtRate.Text);
sda.SelectCommand.Parameters.AddWithValue("@Block", Block); ;
string s = ClsConnect.conSql.State.ToString();
if (s == "Open")
{
ClsConnect.conSql.Close();
}
ClsConnect.conSql.Open();
G_iAccountID = Convert.ToInt32(sda.SelectCommand.ExecuteScalar());
//fnInvoiceItemSave(G_InvID);
ClsConnect.conSql.Close();
if (block == 0)
{
MessageBox.Show(" Invoice Details Insert Successfilly !!");
}
else if (block == 1)
{
MessageBox.Show(" Invoice Details Update Successfilly !!");
}
//fnClearAll();
}
catch (Exception ex)
{
ReturnValue = ex.Message;
}
return ReturnValue;
}
private void btnCancel_Click(object sender, EventArgs e)
{
txtCustName.Clear();
txtCustName.Focus();
}
private void dtpTo_ValueChanged(object sender, EventArgs e)
{
}
}
}