예제 #1
0
        private OutboundRcvd LoadOutbounds(string outboundId)
        {
            OutboundRcvd item = new OutboundRcvd();
            string       sql  = string.Format("select OutboundID,Sales , OrderNo, (PriceAmount + Freight) as InvAmt, RcvdAmount from V_OutboundCash "
                                              + " where PriceAmount > 0  and ShipDate <>'' and OutboundID = '{0}'", outboundId);
            DataTable dt = Database.Select(sql);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(item);
            }

            string temp = "";
            int    i = 0, col = 0;

            item.OutboundId = dt.Rows[i][col++].ToString();
            item.Sales      = dt.Rows[i][col++].ToString();
            item.OutboundNo = dt.Rows[i][col++].ToString();

            temp = dt.Rows[i][col++].ToString();
            if (string.IsNullOrEmpty(temp) == false)
            {
                item.InvoiceAmount = Convert.ToDouble(temp);
            }

            temp = dt.Rows[i][col++].ToString();
            if (string.IsNullOrEmpty(temp) == false)
            {
                item.RcvdAmount = Convert.ToDouble(temp);
            }

            item.BalanceAmount = item.InvoiceAmount - item.RcvdAmount;

            return(item);
        }
예제 #2
0
        private List <OutboundRcvd> LoadOutbounds()
        {
            List <OutboundRcvd> list = new List <OutboundRcvd>();
            string sql = "select OutboundID,Sales , OrderNo, (PriceAmount + Freight) as InvAmt, RcvdAmount from V_OutboundCash ";

            sql += " where PriceAmount > 0  and Sales <> 'NO' and ShipDate <>'' Order By OrderNo ";
            DataTable dt = Database.Select(sql);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(list);
            }
            OutboundRcvd item = null;
            string       temp = "";

            for (int i = 0, col = 0; i < dt.Rows.Count; i++)
            {
                col  = 0;
                temp = dt.Rows[i][1].ToString();
                if (string.IsNullOrEmpty(temp.Trim()))
                {
                    continue;
                }

                item            = new OutboundRcvd();
                item.OutboundId = dt.Rows[i][col++].ToString();
                item.Sales      = dt.Rows[i][col++].ToString();
                item.OutboundNo = dt.Rows[i][col++].ToString();

                temp = dt.Rows[i][col++].ToString();
                if (string.IsNullOrEmpty(temp) == false)
                {
                    item.InvoiceAmount = Convert.ToDouble(temp);
                }

                temp = dt.Rows[i][col++].ToString();
                if (string.IsNullOrEmpty(temp) == false)
                {
                    item.RcvdAmount = Convert.ToDouble(temp);
                }

                item.BalanceAmount = item.InvoiceAmount - item.RcvdAmount;
                //靠PayOff = “yes”
                if (item.BalanceAmount <= 0.0)
                {
                    continue;
                }

                list.Add(item);
            }

            return(list);
        }
예제 #3
0
        private void OnCellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            int nFind = -1;

            if (e.Column == colSales)
            {
                SelectSales(e.Value.ToString());
                return;
            }

            if (e.Column == colOutboundNo)
            {
                nFind = FindOutbound(e.Value.ToString());
                if (nFind < 0)
                {
                    return;
                }
                OutboundRcvd item = OutboundList[nFind];

                gridView.SetRowCellValue(e.RowHandle, colBalance, item.BalanceAmount.ToString("f2"));

                return;
            }

            if (e.Column == colRcvdAmount)
            {
                string poNo = gridView.GetRowCellValue(e.RowHandle, colOutboundNo).ToString();
                nFind = FindOutbound(poNo);
                if (nFind < 0)
                {
                    return;
                }
                OutboundRcvd item = OutboundList[nFind];
                double       val  = 0.0;

                double.TryParse(e.Value.ToString(), out val);

                gridView.SetRowCellValue(e.RowHandle, colBalance, (item.BalanceAmount - val).ToString("f2"));

                return;
            }
        }
예제 #4
0
        private void FrmRcvdEdit_Load(object sender, EventArgs e)
        {
            if (RcvdGridView == null)
            {
                return;
            }
            GridView rcvdView = RcvdGridView;
            int      sel      = rcvdView.FocusedRowHandle;

            boundId         = rcvdView.GetRowCellValue(sel, "OutboundID").ToString();
            recId           = rcvdView.GetRowCellValue(sel, "RecordID").ToString();
            amount          = rcvdView.GetRowCellValue(sel, "RcvdAmount").ToString();
            txtPoNo.Text    = rcvdView.GetRowCellValue(sel, "OutboundNo").ToString();
            txtSales.Text   = rcvdView.GetRowCellValue(sel, "Sales").ToString();
            cboPayOff.Text  = rcvdView.GetRowCellValue(sel, "PayOff").ToString();
            txtRcvdAmt.Text = rcvdView.GetRowCellValue(sel, "RcvdAmount").ToString();
            txtRemark.Text  = rcvdView.GetRowCellValue(sel, "Remark").ToString();
            item            = LoadOutbounds(boundId);
            txtInvAmt.Text  = item.InvoiceAmount.ToString("f2");
        }