private void dgvAdvDetail_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            FormAddAudit        form     = new FormAddAudit();
            SupplierAuditMaster supplier = new SupplierAuditMaster();

            supplier.SupplierNo      = int.Parse(tbSupNo.Text);
            supplier.SupplierAddress = tbAddress.Text;
            supplier.SupplierName    = tbName.Text;
            supplier.SupplierStatus  = 1;
            supplier.SupplierTP01    = tbTPNo1.Text;
            supplier.SupplierTP02    = tbTpNo2.Text;
            supplier.PayMode         = tbPayMode.Text;
            supplier.RouteName       = tbRoute.Text;
            SupplierAudit audit = new SupplierAudit();

            audit.Amount     = float.Parse(dgvAdvDetail.Rows[e.RowIndex].Cells["Advance"].Value.ToString()); //Trn.Date
            audit.TrnDate    = DateTime.Parse(dgvAdvDetail.Rows[e.RowIndex].Cells["Trn.Date"].Value.ToString());
            audit.TrnNumber  = dgvAdvDetail.Rows[e.RowIndex].Cells["VoucherNo"].Value.ToString();
            form.selSupplier = supplier;
            form.audit       = audit;
            form.Owner       = this;

            form.StartPosition = FormStartPosition.CenterParent;
            form.ShowDialog();
        }
Beispiel #2
0
        public void GetAuditEntry()
        {
            sql = " Select d.* from SupplierAuditDetail d inner join SupplierAUditMaster m on  d.SupplierId= m.id Where SupplierNo =" + supplier.SupplierNo +
                  " Order by id Desc ";
            dB = new DBAccess();
            DataTable table = dB.GetDataTable(sql, DBAccess.AUDIT);

            foreach (DataRow dr in table.Rows)
            {
                SupplierAudit sa = new SupplierAudit();
                sa.id          = int.Parse(dr["id"].ToString());
                sa.TrnDate     = DateTime.Parse(dr["TrnDate"].ToString());
                sa.TrnNumber   = dr["TrnNumber"].ToString();
                sa.Remarks     = dr["Remarks"].ToString();
                sa.CreatedBy   = int.Parse(dr["CreatedBy"].ToString());
                sa.CreatedDate = DateTime.Parse(dr["CreatedDate"].ToString());
                supplierAudits.Add(sa);
            }
        }
Beispiel #3
0
        private bool GetComments()
        {
            bool commentStat = false;

            if (tbComment.Text.Trim().Count() == 0)
            {
                MessageBox.Show("The Comments fields cannot be empty", "No Comments", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                tbComment.Focus();
                commentStat = false;
            }
            else
            {
                selSupplier.CreatedBy   = RuntimeDefaults.UserId;
                selSupplier.CreatedDate = DateTime.Now;
                audit.Remarks           = tbComment.Text;
                if (auditEntry == null)
                {
                    auditEntry          = new SupplierAuditEntry();
                    auditEntry.supplier = selSupplier;
                }
                if (isNew)
                {
                    audit.CreatedBy     = RuntimeDefaults.UserId;
                    audit.CreatedDate   = DateTime.Now;
                    auditEntry.supplier = selSupplier;
                    auditEntry.supplierAudits.Add(audit);
                }
                if (isEdit)
                {
                    audit.ModifiedBy   = RuntimeDefaults.UserId;
                    audit.ModifiedDate = DateTime.Now;
                    SupplierAudit audittemp = auditEntry.supplierAudits.Where(o => o.id == audit.id).FirstOrDefault();
                    audittemp.Remarks      = audit.Remarks;
                    audittemp.ModifiedBy   = audit.ModifiedBy;
                    audittemp.ModifiedDate = audit.ModifiedDate;
                }

                commentStat = true;
            }
            return(commentStat);
            //throw new NotImplementedException();
        }
Beispiel #4
0
        private void FormAddAudit_Load(object sender, EventArgs e)
        {
            auditEntry.supplier = selSupplier;
            auditEntry.GetAuditEntry();
            if (auditEntry.supplierAudits.Count > 0)
            {
                SupplierAudit auditTemp = auditEntry.supplierAudits.Where(o => o.TrnNumber.Trim() == audit.TrnNumber).FirstOrDefault();
                if (auditTemp != null)
                {
                    tbComment.Text = auditTemp.Remarks;
                    audit.Remarks  = auditTemp.Remarks;
                    audit.id       = auditTemp.id;
                    isEdit         = true;
                    isNew          = false;
                }
                dgvAC.DataSource = auditEntry.supplierAudits.ToList();
            }

            tbVNo.Text = audit.TrnNumber;
            nAmt.Value = (decimal)audit.Amount;
            SetButtons();
        }