01.
private
void
get3month()
02.
{
03.
string
strd, strd1, strd2, strd3, strm, stry, strdt;
04.
strd1 =
"/31/"
;
05.
strd2 =
"/30/"
;
06.
strd3 =
"/29/"
;
07.
strd = cb_date.EditValue.ToString().Substring(3, 2);
08.
strm = cb_date.EditValue.ToString().Substring(0, 2);
09.
stry = cb_date.EditValue.ToString().Substring(6, 4);
10.
11.
if
(autoquery)
12.
13.
{
14.
}
15.
strdt = strm + strd + stry;
16.
txtdate.EditValue = strdt;
17.
18.
DT = (Convert.ToInt32(StrMount) - Mount);month now - month select = month show
19.
if
((DT < 0))month show < 0
20.
{
21.
DT = 0;month show = 0
22.
DT = (Mount - Convert.ToInt32(StrMount));month show = month select - month now
23.
Str3 = cbdate_str.Text.Substring(6, 4);year now
24.
DT2 = (12 - DT);
25.
DT3 = (Convert.ToInt32(Str3) - 1);year now - 1 = year show
26.
X = DT2.ToString().Length;
27.
if
((X == 1))
28.
{
29.
Dateback = (
"0"
+ DT2.ToString());
30.
Str2 = (Dateback
31.
+ (cbdate_str.Text.Substring(2, 4) + DT3.ToString()));
32.
}
33.
else
34.
{
35.
Str2 = (DT2.ToString()
36.
+ (cbdate_str.Text.Substring(2, 4) + DT3.ToString()));
37.
}
38.
MessageBox.Show(Str2);
39.
dsca = ojsql2.GetDataSet(
"select month(ddate) dmonth,sum(iquantity) qty,sum(isum )amt from salebillvouch a inner join salebillvouchs b on a.sbvid=b.sbvid where cinvcode='"
+ txtpd_code.Text +
"' and ddate>='"
+ cbdate_str.EditValue +
"' and ddate<='"
+ Str2 +
"' group by month(ddate)"
,
"data"
);
40.
gvFile.DataSource = dsca.Tables[0];
41.
}
42.
else
43.
{
44.
Str3 = cbdate_str.Text.Substring(6, 4);
45.
DT3 = (Convert.ToInt32(Str3) - 1);
46.
X = DT.ToString().Length;
47.
if
((X == 1))
48.
{
49.
Dateback = (
"0"
+ DT.ToString());
50.
if
((Dateback ==
"00"
))
51.
{
52.
Str2 = (
"12"
53.
+ (cbdate_str.Text.Substring(2, 4) + DT3.ToString()));
54.
}
55.
else
56.
{
57.
Str2 = (Dateback
58.
+ (cbdate_str.Text.Substring(2, 3) + cbdate_str.Text.Substring(5, 5)));
59.
}
60.
}
61.
else
if
((DT.ToString() ==
"00"
))
62.
{
63.
Str2 = (
"12"
64.
+ (cbdate_str.Text.Substring(2, 4) + DT3.ToString()));
65.
}
66.
else
67.
{
68.
Str2 = (DT.ToString()
69.
+ (cbdate_str.Text.Substring(2, 3) + cbdate_str.Text.Substring(5, 5)));
70.
}
71.
MessageBox.Show(Str2);
72.
dsca = ojsql2.GetDataSet(
"select month(ddate) dmonth,sum(iquantity) qty,sum(isum )amt from salebillvouch a inner join salebillvouchs b on a.sbvid=b.sbvid where cinvcode='"
+ txtpd_code.Text +
"' and ddate>='"
+ Str2 +
"' and ddate<='"
+ cbdate_str.EditValue +
"' group by month(ddate)"
,
"data"
);
73.
gvFile.DataSource = dsca.Tables[0];
74.
}
75.
}