/// <summary>
        /// 取得電子發票原始檔明細
        /// </summary>
        /// <param name="invNo"></param>
        /// <returns></returns>
        private EinvoiceDetalisSendModel GetEinvoiceProtoDetalisByNo(string invNo)
        {
            invNo = string.Concat(invNo[0], invNo[1]).ToUpper() + invNo.Substring(2, invNo.Length - 2);
            EinvoiceDetalisSendModel send = new EinvoiceDetalisSendModel();

            try
            {
                C0401H einvoice = this.module.GetEinvoiceDetalisByNo(invNo);
                if (einvoice == null)
                {
                    throw new Exception("[系統]查無相關電子發票原始檔明細明細");
                }
                int    getMonth = Convert.ToInt16(einvoice.MInvoiceDate.Substring(4, 2));
                var    chkMonth = (getMonth % 2) == 1;
                string invTerm  = string.Format("{0}{1}", einvoice.MInvoiceDate.Substring(0, 4), chkMonth ? (getMonth + 1).ToString().PadLeft(2, '0') : (getMonth).ToString().PadLeft(2, '0'));
                string y        = einvoice.MInvoiceDate.Substring(0, 4);
                string m        = einvoice.MInvoiceDate.Substring(4, 2);
                string d        = einvoice.MInvoiceDate.Substring(6, 2);
                string date     = string.Format("{0}/{1}/{2}", y, m, d);
                send.invTerm      = invTerm;
                send.invDate      = date;
                send.randomNumber = einvoice.MRandomNumber;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(send);
        }
Exemplo n.º 2
0
        public C0401H GetEinvoiceDetalisByNo(string invNo)
        {
            C0401H einvoice = this.DB.C0401H.Where(o => o.MInvoiceNumber == invNo).FirstOrDefault();

            return(einvoice);
        }