예제 #1
0
        /// <summary>
        /// 获取指定日期内的金额
        /// </summary>
        internal void m_mthGetAllMoney()
        {
            m_objViewer.m_lblBuyInMoney.Text  = string.Empty;
            m_objViewer.m_lblRetailMoney.Text = string.Empty;

            DateTime dtmBegin = Convert.ToDateTime(Convert.ToDateTime(m_objViewer.m_dtpBeginDatePage1.Text).ToString("yyyy-MM-dd 00:00:00"));
            DateTime dtmEnd   = Convert.ToDateTime(Convert.ToDateTime(m_objViewer.m_dtpEndDatePage1.Text).ToString("yyyy-MM-dd 23:59:59"));

            clsDcl_OutStorage objOSDomain = new clsDcl_OutStorage();

            if (m_objViewer.m_dtbAllMoney == null)
            {
                long lngRes = objOSDomain.m_lngGetAllInMoney(dtmBegin, dtmEnd, m_objViewer.m_strStorageID, 4, out m_objViewer.m_dtbAllMoney);
            }

            if (m_objViewer.m_dtbAllMoney != null && m_objViewer.m_dtbAllMoney.Rows.Count == 0)
            {
                m_objViewer.m_dtbAllMoney = null;
            }

            if (m_objViewer.m_dtbAllMoney != null && m_objViewer.m_dtvCurrentMainVienPage1 != null)
            {
                //StringBuilder stbFilter = new StringBuilder(100);
                //int intRowsCount = m_objViewer.m_dtvCurrentMainVienPage1.Count;
                //for (int iRow = 0; iRow < intRowsCount; iRow++)
                //{
                //    stbFilter.Append(" seriesid_int =");
                //    stbFilter.Append(m_objViewer.m_dtvCurrentMainVienPage1[iRow]["SERIESID_INT"].ToString());
                //    if (iRow < intRowsCount - 1)
                //    {
                //        stbFilter.Append(" or ");
                //    }
                //}

                string strFilterResult = m_strMainFilter();

                //if (!string.IsNullOrEmpty(strFilterResult))
                //{
                DataRow[] drAllMoney = m_objViewer.m_dtbAllMoney.Select(strFilterResult);

                if (drAllMoney != null && drAllMoney.Length > 0)
                {
                    decimal dcmBuyIn      = 0m;
                    decimal dcmRetailSale = 0m;
                    for (int iM = 0; iM < drAllMoney.Length; iM++)
                    {
                        dcmBuyIn      += Convert.ToDecimal(drAllMoney[iM]["BuyInMoney"]);
                        dcmRetailSale += Convert.ToDecimal(drAllMoney[iM]["RetailPrice"]);
                    }

                    m_objViewer.m_lblBuyInMoney.Text  = dcmBuyIn.ToString("0.0000");
                    m_objViewer.m_lblRetailMoney.Text = dcmRetailSale.ToString("0.0000");
                }
                //}
            }
        }
예제 #2
0
        /// <summary>
        /// 获取指定日期内的金额
        /// </summary>
        internal void m_mthGetAllMoney()
        {
            m_objViewer.m_lblBuyInMoney.Text  = string.Empty;
            m_objViewer.m_lblRetailMoney.Text = string.Empty;

            DateTime dtmBegin = Convert.ToDateTime(Convert.ToDateTime(m_objViewer.m_dtpSearchBeginDate.Text).ToString("yyyy-MM-dd 00:00:00"));
            DateTime dtmEnd   = Convert.ToDateTime(Convert.ToDateTime(m_objViewer.m_dtpSearchEndDate.Text).ToString("yyyy-MM-dd 23:59:59"));

            clsDcl_OutStorage objOSDomain = new clsDcl_OutStorage();

            if (m_objViewer.m_dtbAllMoney == null)
            {
                long lngRes = objOSDomain.m_lngGetAllInMoney(dtmBegin, dtmEnd, m_objViewer.m_strStorageID, 2, out m_objViewer.m_dtbAllMoney);
            }

            if (m_objViewer.m_dtbAllMoney != null && m_objViewer.m_dtbAllMoney.Rows.Count == 0)
            {
                m_objViewer.m_dtbAllMoney = null;
            }

            if (m_objViewer.m_dtbAllMoney != null && m_objViewer.m_dtvCurrentMainView != null)
            {
                //StringBuilder stbFilter = new StringBuilder(100);
                int intRowsCount = m_objViewer.m_dtvCurrentMainView.Count;
                System.Collections.Hashtable hstMedicine = new System.Collections.Hashtable();
                for (int iRow = 0; iRow < intRowsCount; iRow++)
                {
                    hstMedicine.Add(Convert.ToInt64(m_objViewer.m_dtvCurrentMainView[iRow]["seriesid_int"]), m_objViewer.m_dtvCurrentMainView[iRow]["outstorageid_vchr"].ToString());
                }

                string strFilterResult = m_strMainFilter();

                //if (!string.IsNullOrEmpty(strFilterResult))
                //{
                DataRow[] drAllMoney = m_objViewer.m_dtbAllMoney.Select(strFilterResult);

                if (drAllMoney != null && drAllMoney.Length > 0)
                {
                    decimal dcmBuyIn      = 0m;
                    decimal dcmRetailSale = 0m;
                    for (int iM = 0; iM < drAllMoney.Length; iM++)
                    {
                        if (!hstMedicine.Contains(Convert.ToInt64(drAllMoney[iM]["seriesid_int"])))
                        {
                            continue;
                        }
                        dcmBuyIn      += Convert.ToDecimal(drAllMoney[iM]["BuyInMoney"]);
                        dcmRetailSale += Convert.ToDecimal(drAllMoney[iM]["RetailPrice"]);
                    }

                    m_objViewer.m_lblBuyInMoney.Text  = dcmBuyIn.ToString("0.0000");
                    m_objViewer.m_lblRetailMoney.Text = dcmRetailSale.ToString("0.0000");
                }
                //}
            }
        }