-
Notifications
You must be signed in to change notification settings - Fork 0
/
Smt_Mer_POApproval.aspx.cs
704 lines (652 loc) · 28.7 KB
/
Smt_Mer_POApproval.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
using AjaxControlToolkit;
using ASP;
using C1.Web.UI.Controls.C1GridView;
using C1.Web.UI.Controls.C1TabControl;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Net.Mime;
using System.Net.NetworkInformation;
using System.Text;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Smt_Mer_POApproval : System.Web.UI.Page
{
private BLL _bll = new BLL();
private MC _mc = new MC();
private BLLInventory blInventory = new BLLInventory();
protected Button btnCnfApprove;
protected ConfirmButtonExtender btnCnfApprove_ConfirmButtonExtender;
protected Button btnConCancel;
protected Button btnRevised;
protected Button btnReviseForApp;
protected ConfirmButtonExtender btnReviseForApp_ConfirmButtonExtender2;
protected C1.Web.UI.Controls.C1TabControl.C1TabControl C1TabControl1;
protected C1TabPage C1TabPage1;
protected C1TabPage C1TabPage2;
protected C1TabPage C1TabPage3;
protected C1TabPage C1TabPage4;
protected C1TabPage C1TabPage5;
private System.Data.SqlClient.SqlConnection cn = GetWay.SpecFo_Inventorycon;
protected ConfirmButtonExtender ConfirmButtonExtender1;
protected ConfirmButtonExtender confrev;
private int ConfToApp;
private DALInventory dlInventory = new DALInventory();
private int forApp;
protected C1.Web.UI.Controls.C1GridView.C1GridView grdApproved;
protected C1.Web.UI.Controls.C1GridView.C1GridView grdCanceled;
//protected C1.Web.UI.Controls.C1GridView.C1GridView grdConfirmToApprove;
protected GridView grdDisPODtl;
protected C1.Web.UI.Controls.C1GridView.C1GridView grdForApproval;
protected C1.Web.UI.Controls.C1GridView.C1GridView grdPORevised;
protected Label Label1;
protected Label Label2;
protected Label Label3;
protected Label Label4;
protected Label lblModlHdr;
private DAL mycls = new DAL();
private int revForApp;
protected Button txtApproval;
protected ConfirmButtonExtender txtApproval_ConfirmButtonExtender;
//protected UpdatePanel UpdatePanel1;
protected UpdatePanel UpdatePanel2;
protected UpdatePanel UpdatePanel3;
protected UpdatePanel UpdatePanel4;
protected UpdatePanel UpdatePanel5;
protected UpdatePanel UpdatePanel6;
protected UpdatePanel updpnlQutantitybreakdown;
protected UpdatePanel updPODtl;
//public void bindapprove()
//{
// this.grdApproved.DataSource = (this.blInventory.get_InformationdataTable("Sp_Smt_PO_GetApprove '" + this.Session["Uid"].ToString() + "'"));
// this.grdApproved.DataBind();
//}
//public void bindcanceled()
//{
// this.grdCanceled.DataSource = (this.blInventory.get_InformationdataTable("Sp_Smt_PO_GetCanceled '" + this.Session["Uid"].ToString() + "'"));
// this.grdCanceled.DataBind();
//}
public void bindconfirmtoapprove()
{
this.grdConfirmToApprove.DataSource = (this.blInventory.get_InformationdataTable("Sp_Smt_PO_GetConfirmToApprove '" + this.Session["Uid"].ToString() + "'"));
this.grdConfirmToApprove.DataBind();
}
//public void bindforapproval()
//{
// this.grdForApproval.DataSource = (this.blInventory.get_InformationdataTable("Sp_Smt_PO_GetForApprove '" + this.Session["Uid"].ToString() + "'"));
// this.grdForApproval.DataBind();
//}
//public void bindrevised()
//{
// this.grdPORevised.DataSource = (this.blInventory.get_InformationdataTable("Sp_Smt_PO_GetRevised '" + this.Session["Uid"].ToString() + "'"));
// this.grdPORevised.DataBind();
//}
protected void btnCnfApprove_Click(object sender, System.EventArgs e)
{
Label label = (Label)base.Master.FindControl("lbltotalinfo");
if (this.grdConfirmToApprove.Rows.Count > 0)
{
for (int i = 0; i < this.grdConfirmToApprove.Rows.Count; i = (int)(i + 1))
{
//string str = this.grdConfirmToApprove.Rows.get_Item(i).Cells.get_Item(3).get_Text().Trim();
string str = this.grdConfirmToApprove.Rows[i].Cells[3].Text.Trim();
CheckBox box = (CheckBox)this.grdConfirmToApprove.Rows[i].FindControl("chkSelect");
if (box.Checked)
{
this.dlInventory.PO_ConfirmToApprove(int.Parse(str));
this.ConfToApp = (int)(this.ConfToApp + 1);
}
}
if (this.ConfToApp > 0)
{
label.Text = ("Confirm To Approve " + ((int)this.ConfToApp) + " PO");
}
else
{
label.Text = ("Check PO First");
}
}
this.bindconfirmtoapprove();
this.grdConfirmToApprove.DataBind();
//this.bindforapproval();
}
protected void btnCancel_Click(object sender, System.EventArgs e)
{
Label label = (Label)base.Master.FindControl("lbltotalinfo");
this.cn.Open();
System.Data.SqlClient.SqlTransaction transaction = this.cn.BeginTransaction();
try
{
if (this.grdConfirmToApprove.Rows.Count > 0)
{
for (int i = 0; i < this.grdConfirmToApprove.Rows.Count; i = (int)(i + 1))
{
CheckBox box = (CheckBox)this.grdConfirmToApprove.Rows[i].FindControl("chkSelect");
if (box.Checked)
{
string str = this.grdConfirmToApprove.Rows[i].Cells[3].Text.Trim();
string[] strArray = new string[] { "@PONO", "@cncluser" };
string[] strArray2 = new string[] { str.Trim(), this.Session["Uid"].ToString() };
this._mc.MC_Save_nodt_tr("Sp_Smt_BOM_POCancel", this.cn, transaction, strArray, strArray2);
}
}
}
transaction.Commit();
label.Text = ("Cancelled Successfully");
this.bindconfirmtoapprove();
//this.bindcanceled();
}
catch (System.Exception)
{
transaction.Rollback();
label.Text = ("Unable to Cancel");
}
finally
{
this.cn.Close();
}
}
protected void btnEmail_Click(object sender, System.EventArgs e)
{
Label label = (Label)base.Master.FindControl("lbltotalinfo");
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
LinkButton button1 = (LinkButton)parent.FindControl("btnEmail");
Label label2 = (Label)parent.FindControl("lblSupplierID");
Label label3 = (Label)parent.FindControl("lblPO");
try
{
this.Sentmail_supplier(int.Parse(label3.Text), int.Parse(label2.Text));
label.Text = ("Success");
}
catch (System.Exception exception)
{
label.Text = (exception.Message);
}
}
protected void btnPODtlview_Click(object sender, System.EventArgs e)
{
//this.grdDisPODtl.set_DataSource(null);
this.grdDisPODtl.DataSource = null;
this.grdDisPODtl.DataBind();
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
string str = parent.Cells[3].Text.Trim();
this.viewPODtl(int.Parse(str));
}
protected void btnPrintAprov_Click(object sender, System.EventArgs e)
{
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
LinkButton button = (LinkButton)parent.FindControl("btnPrintAprov");
this.Session["pono"] = button.CommandArgument;
this.Session["Param"] = "PONO";
this.runjQueryCode("window.open('Report_Merchandising/Smt_MerchandisingReport.aspx','popup','location=1,status=1,left=0,top=0,scrollbars=1,width=970,height=600')");
}
protected void btnPrintCanceled_Click(object sender, System.EventArgs e)
{
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
LinkButton button = (LinkButton)parent.FindControl("btnPrintCanceled");
this.Session["pono"] = button.CommandArgument;
this.Session["Param"] = "PONO";
this.runjQueryCode("window.open('Report_Merchandising/Smt_MerchandisingReport.aspx','popup','location=1,status=1,left=0,top=0,scrollbars=1,width=970,height=600')");
}
protected void btnPrintForApp_Click(object sender, System.EventArgs e)
{
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
LinkButton button = (LinkButton)parent.FindControl("btnPrintForApp");
this.Session["pono"] = button.CommandArgument;
this.Session["Param"] = "PONO";
this.runjQueryCode("window.open('Report_Merchandising/Smt_MerchandisingReport.aspx','popup','location=1,status=1,left=0,top=0,scrollbars=1,width=970,height=600')");
}
protected void btnPrintpoconfirm_Click(object sender, System.EventArgs e)
{
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
string str = parent.Cells[3].Text.Trim();
this.Session["pono"] = str;
this.Session["Param"] = "PONO";
this.runjQueryCode("window.open('Report_Merchandising/Smt_MerchandisingReport.aspx','popup','location=1,status=1,left=0,top=0,scrollbars=1,width=970,height=600')");
}
protected void btnPrintRevised_Click(object sender, System.EventArgs e)
{
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
LinkButton button = (LinkButton)parent.FindControl("btnPrintRevised");
this.Session["pono"] = button.CommandArgument;
this.Session["Param"] = "PONO";
this.runjQueryCode("window.open('Report_Merchandising/Smt_MerchandisingReport.aspx','popup','location=1,status=1,left=0,top=0,scrollbars=1,width=970,height=600')");
}
protected void btnRevised_Click(object sender, System.EventArgs e)
{
Label label = (Label)base.Master.FindControl("lbltotalinfo");
this.cn.Open();
System.Data.SqlClient.SqlTransaction transaction = this.cn.BeginTransaction();
try
{
if (this.grdApproved.Rows.Count > 0)
{
for (int i = 0; i < this.grdApproved.Rows.Count; i = (int)(i + 1))
{
CheckBox box = (CheckBox)this.grdApproved.Rows[i].FindControl("chkSelect");
if (box.Checked)
{
Label label2 = (Label)this.grdApproved.Rows[i].FindControl("lblPO");
string[] strArray = new string[] { "@PONO", "@revuser" };
string[] strArray2 = new string[] { label2.Text.Trim(), this.Session["Uid"].ToString() };
this._mc.MC_Save_nodt_tr("Sp_Smt_BOM_PORevise", this.cn, transaction, strArray, strArray2);
}
}
}
transaction.Commit();
label.Text = ("Revised Successfully");
//this.bindapprove();
//this.bindrevised();
}
catch (System.Exception exception)
{
transaction.Rollback();
label.Text = (exception.Message);
}
finally
{
this.cn.Close();
}
}
protected void btnReviseForApp_Click(object sender, System.EventArgs e)
{
Label label = (Label)base.Master.FindControl("lbltotalinfo");
this.cn.Open();
System.Data.SqlClient.SqlTransaction transaction = this.cn.BeginTransaction();
try
{
if (this.grdForApproval.Rows.Count > 0)
{
for (int i = 0; i < this.grdForApproval.Rows.Count; i = (int)(i + 1))
{
CheckBox box = (CheckBox)this.grdForApproval.Rows[i].FindControl("chkSelectforApp");
if (box.Checked)
{
string str = this.grdForApproval.Rows[i].Cells[3].Text.Trim();
string[] strArray = new string[] { "@PONO", "@revuser" };
string[] strArray2 = new string[] { str.Trim(), this.Session["Uid"].ToString() };
this._mc.MC_Save_nodt_tr("Sp_Smt_BOM_PORevise", this.cn, transaction, strArray, strArray2);
}
}
}
transaction.Commit();
label.Text = ("Revised Successfully");
//this.bindforapproval();
//this.bindapprove();
//this.bindrevised();
}
catch (System.Exception)
{
transaction.Rollback();
label.Text = ("Unable to Revise");
}
finally
{
this.cn.Close();
}
}
protected void btnViewAprv_Click(object sender, System.EventArgs e)
{
this.grdDisPODtl.DataSource = null;
this.grdDisPODtl.DataBind();
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
LinkButton button = (LinkButton)parent.FindControl("btnViewAprv");
this.viewPODtl (int.Parse(button.CommandArgument));
}
protected void btnViewCanceled_Click(object sender, System.EventArgs e)
{
this.grdDisPODtl.DataSource =null;
this.grdDisPODtl.DataBind();
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
LinkButton button = (LinkButton)parent.FindControl("btnViewCanceled");
this.viewPODtl(int.Parse(button.CommandArgument));
}
protected void btnViewForApp_Click(object sender, System.EventArgs e)
{
this.grdDisPODtl.DataSource =null;
this.grdDisPODtl.DataBind();
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
LinkButton button = (LinkButton)parent.FindControl("btnViewForApp");
parent.Cells[3].Text.Trim();
this.viewPODtl(int.Parse(button.CommandArgument));
}
protected void btnViewRevised_Click(object sender, System.EventArgs e)
{
this.grdDisPODtl.DataSource =null;
this.grdDisPODtl.DataBind();
C1GridViewRow parent = ((LinkButton)sender).Parent.Parent as C1GridViewRow;
LinkButton button = (LinkButton)parent.FindControl("btnViewRevised");
this.viewPODtl(int.Parse(button.CommandArgument));
}
public void execmail(string user, int pono, int supplier, string attachfile)
{
System.Data.SqlClient.SqlConnection connection = GetWay.SpecFo_Inventorycon;
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand("Sp_Smt_POHeader_Sendmail", connection);
if (connection.State == System.Data.ConnectionState.Closed)
{
connection.Open();
}
command.CommandType = (System.Data.CommandType.StoredProcedure);
command.Parameters.AddWithValue("@UserId", user);
command.Parameters.AddWithValue("@PONO", (int)pono);
command.Parameters.AddWithValue("@SupplierID", (int)supplier);
command.Parameters.AddWithValue("@Attachfile", attachfile);
command.ExecuteNonQuery();
if (connection.State == System.Data.ConnectionState.Open)
{
connection.Close();
}
}
private string getjQueryCode(string jsCodetoRun)
{
System.Text.StringBuilder builder = new System.Text.StringBuilder();
builder.AppendLine("$(document).ready(function() {");
builder.AppendLine(jsCodetoRun);
builder.AppendLine(" });");
return builder.ToString();
}
protected void grdApproved_Filtering(object sender, C1GridViewFilterEventArgs e)
{
//this.bindapprove();
}
protected void grdApproved_PageIndexChanging(object sender, C1GridViewPageEventArgs e)
{
this.grdApproved.PageIndex = (e.NewPageIndex);
//this.bindapprove();
}
protected void grdApproved_RowDataBound(object sender, C1GridViewRowEventArgs e)
{
if (e.Row.RowType == C1GridViewRowType.DataRow)
{
Label label = (Label)e.Row.FindControl("lblPO");
CheckBox box = (CheckBox)e.Row.FindControl("chkSelect");
LinkButton button1 = (LinkButton)e.Row.FindControl("btnEmail");
System.Data.DataTable table = this.blInventory.get_InformationdataTable("select nOrderType from Smt_POHedder where nPoNum=" + label.Text);
if ((table.Rows.Count > 0) && !string.IsNullOrEmpty(table.Rows[0]["nOrderType"].ToString()))
{
e.Row.Attributes.Add("style", "color:#21BAF3;border:1px solid white;font-weight:bold;font-style:italic");
e.Row.ToolTip = ("Other Booking");
}
if (this.blInventory.get_InformationdataTable("select nPoNum from Smt_GoodReceived where nPoNum=" + label.Text + " and bApp=1").Rows.Count > 0)
{
box.Enabled = (false);
e.Row.ForeColor = (Color.Red);
e.Row.ToolTip = ("GRN Completed for this PO");
}
}
}
protected void grdCanceled_Filtering(object sender, C1GridViewFilterEventArgs e)
{
//this.bindcanceled();
}
protected void grdCanceled_PageIndexChanging(object sender, C1GridViewPageEventArgs e)
{
this.grdCanceled.PageIndex = (e.NewPageIndex);
//this.bindcanceled();
}
protected void grdCanceled_RowDataBound(object sender, C1GridViewRowEventArgs e)
{
if (e.Row.RowType == C1GridViewRowType.DataRow)
{
System.Data.DataTable table = this.blInventory.get_InformationdataTable("select nOrderType from Smt_POHedder where nPoNum=" + e.Row.Cells[2].Text.Trim());
if ((table.Rows.Count > 0) && !string.IsNullOrEmpty(table.Rows[0]["nOrderType"].ToString()))
{
e.Row.Attributes.Add("style", "color:#21BAF3;border:1px solid white;font-weight:bold;font-style:italic");
e.Row.ToolTip = ("Other Booking");
}
}
}
protected void grdConfirmToApprove_Filtering(object sender, C1GridViewFilterEventArgs e)
{
this.bindconfirmtoapprove();
}
protected void grdConfirmToApprove_PageIndexChanging(object sender, C1GridViewPageEventArgs e)
{
this.grdConfirmToApprove.PageIndex = (e.NewPageIndex);
this.bindconfirmtoapprove();
}
protected void grdConfirmToApprove_RowDataBound(object sender, C1GridViewRowEventArgs e)
{
if (e.Row.RowType == C1GridViewRowType.DataRow)
{
System.Data.DataTable table = this.blInventory.get_InformationdataTable("select nOrderType from Smt_POHedder where nPoNum=" + e.Row.Cells[3].Text.Trim());
if ((table.Rows.Count > 0) && !string.IsNullOrEmpty(table.Rows[0]["nOrderType"].ToString()))
{
e.Row.Attributes.Add("style", "color:#21BAF3;border:1px solid white;font-weight:bold;font-style:italic");
e.Row.ToolTip = ("Other Booking");
}
}
}
protected void grdDisPODtl_PreRender(object sender, System.EventArgs e)
{
MergePOConfrimPODtl(this.grdDisPODtl);
}
protected void grdForApproval_Filtering(object sender, C1GridViewFilterEventArgs e)
{
//this.bindforapproval();
}
protected void grdForApproval_PageIndexChanging(object sender, C1GridViewPageEventArgs e)
{
this.grdForApproval.PageIndex = (e.NewPageIndex);
//this.bindforapproval();
}
protected void grdForApproval_RowDataBound(object sender, C1GridViewRowEventArgs e)
{
if (e.Row.RowType == C1GridViewRowType.DataRow)
{
System.Data.DataTable table = this.blInventory.get_InformationdataTable("select nOrderType from Smt_POHedder where nPoNum=" + e.Row.Cells[3].Text.Trim());
if ((table.Rows.Count > 0) && !string.IsNullOrEmpty(table.Rows[0]["nOrderType"].ToString()))
{
e.Row.Attributes.Add("style", "color:#21BAF3;border:1px solid white;font-weight:bold;font-style:italic");
e.Row.ToolTip = ("Other Booking");
}
}
}
protected void grdPORevised_Filtering(object sender, C1GridViewFilterEventArgs e)
{
//this.bindrevised();
}
protected void grdPORevised_PageIndexChanging(object sender, C1GridViewPageEventArgs e)
{
this.grdPORevised.PageIndex = (e.NewPageIndex);
//this.bindrevised();
}
protected void grdPORevised_RowDataBound(object sender, C1GridViewRowEventArgs e)
{
if (e.Row.RowType == C1GridViewRowType.DataRow)
{
System.Data.DataTable table = this.blInventory.get_InformationdataTable("select nOrderType from Smt_POHedder where nPoNum=" + e.Row.Cells[2].Text.Trim());
if ((table.Rows.Count > 0) && !string.IsNullOrEmpty(table.Rows[0]["nOrderType"].ToString()))
{
e.Row.Attributes.Add("style", "color:#21BAF3;border:1px solid white;font-weight:bold;font-style:italic");
e.Row.ToolTip = ("Other Booking");
}
}
}
public bool IsConnectedToInternet()
{
string str = "www.google.com";
bool flag = false;
Ping ping = new Ping();
try
{
if (ping.Send(str, 0xbb8).Status == IPStatus.Success)
{
flag = true;
}
}
catch
{
}
return flag;
}
public static void MergePOConfrimPODtl(GridView gridView)
{
for (int i = (int)(gridView.Rows.Count - 2); i >= 0; i = (int)(i - 1))
{
GridViewRow row = gridView.Rows[i];
GridViewRow row2 = gridView.Rows[(int)(i + 1)];
if (row.Cells[0].Text == row2.Cells[0].Text)
{
row.Cells[0].RowSpan = ((row2.Cells[0].RowSpan < 2) ? ((int)2) : ((int)(row2.Cells[0].RowSpan + 1)));
row2.Cells[0].Visible = false;
}
if (row.Cells[1].Text == row2.Cells[1].Text)
{
row.Cells[1].RowSpan = ((row2.Cells[1].RowSpan < 2) ? ((int)2) : ((int)(row2.Cells[1].RowSpan + 1)));
row2.Cells[1].Visible = false;
}
if (row.Cells[2].Text == row2.Cells[2].Text)
{
row.Cells[2].RowSpan = ((row2.Cells[2].RowSpan < 2) ? ((int)2) : ((int)(row2.Cells[2].RowSpan + 1)));
row2.Cells[2].Visible = false;
}
}
}
protected void Page_Load(object sender, System.EventArgs e)
{
if (this.Session["Uid"] == null)
{
base.Response.Redirect("Smt_Login.aspx", false);
}
else if (!base.IsPostBack)
{
Control[] controlArray = new Control[] { this.btnCnfApprove, this.btnConCancel, this.txtApproval, this.btnReviseForApp, this.btnRevised };
Control[] controlArray2 = new Control[0];
this.mycls.SetBtnPermission(this.Session["Uid"].ToString(), controlArray, controlArray2, "Smt_Mer_POApproval.aspx");
this.bindconfirmtoapprove();
//this.bindforapproval();
//this.bindapprove();
//this.bindrevised();
//this.bindcanceled();
//if (base.Request.QueryString["tb"] == "2")
//{
// this.C1TabControl1.MoveNext();
//}
}
}
private void runjQueryCode(string jsCodetoRun)
{
ScriptManager current = ScriptManager.GetCurrent(this);
if ((current != null) && current.IsInAsyncPostBack)
{
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), System.Guid.NewGuid().ToString(), this.getjQueryCode(jsCodetoRun), true);
}
else
{
base.ClientScript.RegisterClientScriptBlock(typeof(Page), System.Guid.NewGuid().ToString(), this.getjQueryCode(jsCodetoRun), true);
}
}
public void Sentmail_supplier(int PONO, int sup)
{
ReportDocument document = new ReportDocument();
string str = base.Server.MapPath("rptsv/");
Merchandising merchandising = new Merchandising();
string val = this._bll.get_Informationdataset("select cCmpName from Smt_Company where Display_AS_Header=1").Tables[0].Rows[0]["cCmpName"].ToString();
new System.Data.DataTable().TableName = "PO_Printing";
System.Data.DataTable table = this.blInventory.get_InformationdataTable("Sp_Smt_POPrinting " + ((int)PONO));
//merchandising.Tables.get_Item("PO_Printing").Merge(table);
merchandising.Tables["PO_Printing"].Merge(table);
document.Load(base.Server.MapPath("Report_Merchandising/CrystalReport2.rpt"));
document.SetDataSource((System.Data.DataSet)merchandising);
document.SetParameterValue("cCmpName", val);
System.IO.MemoryStream stream1 = (System.IO.MemoryStream)document.ExportToStream(ExportFormatType.PortableDocFormat);
base.Response.Clear();
ContentType type = new ContentType();
base.Response.Buffer = true;
type.MediaType = ("application/pdf");
string fileName = str + ((int)PONO) + ".pdf";
document.ExportToDisk(ExportFormatType.PortableDocFormat, fileName);
this.execmail(this.Session["Uid"].ToString(), PONO, sup, base.Server.MapPath("rptsv/") + ((int)PONO) + ".pdf");
if (System.IO.File.Exists(fileName))
{
System.IO.File.Delete(fileName);
}
}
public void Sm_Em_L(int PONO, string Supplieremail, string supname)
{
this._bll.get_InformationdataTable("select Email from Smt_Users where cUserName='" + this.Session["Uid"].ToString() + "'").Rows[0]["Email"].ToString();
ReportDocument document = new ReportDocument();
string str = base.Server.MapPath("rptsv/");
Merchandising merchandising = new Merchandising();
string val = this._bll.get_Informationdataset("select cCmpName from Smt_Company where Display_AS_Header=1").Tables[0].Rows[0]["cCmpName"].ToString();
new System.Data.DataTable().TableName = ("PO_Printing");
System.Data.DataTable table2 = this.blInventory.get_InformationdataTable("Sp_Smt_POPrinting " + ((int)PONO));
merchandising.Tables["PO_Printing"].Merge(table2);
document.Load(base.Server.MapPath("Report_Merchandising/CrystalReport2.rpt"));
document.SetDataSource((System.Data.DataSet)merchandising);
document.SetParameterValue("cCmpName", val);
System.IO.MemoryStream stream1 = (System.IO.MemoryStream)document.ExportToStream(ExportFormatType.PortableDocFormat);
base.Response.Clear();
ContentType type = new ContentType();
base.Response.Buffer = true;
type.MediaType = ("application/pdf");
string fileName = string.Concat((object[])new object[] { str, supname, "_", ((int)PONO), ".pdf" });
if (System.IO.File.Exists(fileName))
{
System.IO.File.Delete(fileName);
}
document.ExportToDisk(ExportFormatType.PortableDocFormat, fileName);
}
protected void txtApproval_Click(object sender, System.EventArgs e)
{
Label label = (Label)base.Master.FindControl("lbltotalinfo");
if (this.grdForApproval.Rows.Count > 0)
{
for (int i = 0; i < this.grdForApproval.Rows.Count; i = (int)(i + 1))
{
string str = this.grdForApproval.Rows[i].Cells[3].Text.Trim();
CheckBox box = (CheckBox)this.grdForApproval.Rows[i].FindControl("chkSelectforApp");
if (box.Checked)
{
this.dlInventory.PO_ForApprove(int.Parse(str), this.Session["Uid"].ToString());
this.forApp = (int)(this.forApp + 1);
}
}
if (this.forApp > 0)
{
label.Text = (((int)this.forApp) + " PO For Approve");
}
else
{
label.Text = ("First Check PO For Approve");
}
}
//this.bindforapproval();
////this.bindapprove();
}
public void viewPODtl(int pono)
{
this.grdDisPODtl.DataSource = (this.blInventory.get_Informationdataset("Sp_Smt_POPrinting '" + ((int)pono) + "'"));
this.grdDisPODtl.DataBind();
this.lblModlHdr.Text = ("Purchase Order Detail - PO No " + ((int)pono).ToString());
this.runjQueryCode("$('.poview').live('click', function (e) {");
this.runjQueryCode("e.preventDefault();");
this.runjQueryCode("$('.POPUPPanel').hide();");
this.runjQueryCode("$('.POPUPPanel').toggle('slow');");
this.runjQueryCode("return false;})");
}
//protected global_asax ApplicationInstance
//{
// get
// {
// return (global_asax)this.Context.ApplicationInstance;
// }
//}
//protected DefaultProfile Profile
//{
// get
// {
// return (DefaultProfile)this.Context.Profile;
// }
//}
protected void btnconfirmtoapp_Click(object sender, EventArgs e)
{
}
}