public void SetCompanyInfo(CompanyDataEntity p_entity)
        {
            m_companyEntity = p_entity;

            txtname.Text = m_companyEntity.Name == null ? "" : m_companyEntity.Name;
            txtaddress.Text = m_companyEntity.Address == null ? "" : m_companyEntity.Address;
            txtcontact.Text = m_companyEntity.ContactNumber == null ? "" : m_companyEntity.ContactNumber;
        }
 public CompanyDataEntity ProcessCompanyInfo()
 {
     CompanyDataEntity company = new CompanyDataEntity();
     company.CompanyID = m_companyEntity.CompanyID;
     company.Name = txtname.Text;
     company.Address = txtaddress.Text;
     company.ContactNumber = txtcontact.Text;
     return company;
 }
Esempio n. 3
0
 public void Delete(CompanyDataEntity p_company)
 {
     using(var session = NHibernateHelper.OpenSession())
     {
         using(var transaction = session.BeginTransaction())
         {
             try
             {
                 session.Delete(p_company);
                 transaction.Commit();
             }
             catch(Exception ex)
             {
                 transaction.Rollback();
                 throw ex;
             }
         }
     }
 }
        public static void PrintHeader(ref StringBuilder sb, CompanyDataEntity company)
        {
            sb.Append(SetAlignment("CENTER"));
            sb.Append(SetFontSize(1));
            sb.AppendLine(company.Name.ToUpper());
            sb.Append(SetFontSize(0));

            string[] tempArr = (company.Address.Replace("\r\n"," ")).Split(' ');
            string address="";
            for(int i=0;i<tempArr.Length;i++)
            {
                address+=tempArr[i] + " ";
                if((address.TrimEnd().Split(' ').Length == 3) || i == (tempArr.Length-1)){
                    sb.AppendLine(address.ToUpper());
                    address="";
                }
            }
            tempArr=null;
            tempArr = company.ContactNumber.Split(';');
            string contactNum="";
            for(int i=0;i<tempArr.Length;i++)
            {
                contactNum += "# " + tempArr[i].TrimStart().TrimEnd() + " ";
            }
            sb.AppendLine(contactNum);
            sb.AppendLine("");
            sb.AppendLine("");
        }
        private static void PrintRefillOrderSlip(ref StringBuilder sb, RefillHeaderDataEntity header,CompanyDataEntity company)
        {
            string[] itemArr;
            string item = "";

            PrintHeader(ref sb,company);
            sb.Append(SetFontSize(2));
            sb.AppendLine("ORDER SLIP");
            sb.Append(SetFontSize(0));
            sb.AppendLine("");
            sb.Append(SetAlignment("LEFT"));
            sb.AppendLine("SO# :              " + header.RefillHeaderID.ToString());
            sb.AppendLine("CUSTOMER :         " + header.Customer.Name.ToUpper());
            sb.AppendLine("DATE RECEIVED :    " + header.Date.ToShortDateString());
            sb.AppendLine("TRANSACTION TYPE : " + header.TransactionType.Name.ToUpper());
            sb.AppendLine("");

            sb.AppendLine("#OF ITEMS             " + SetAlignment("CENTER") +
                 "ITEM             TOTAL");
            int storebottle = 0;
            int storecap = 0;
            foreach(RefillDetailDataEntity detail in header.DetailEntities)
            {
                itemArr = detail.ProductType.Name.Split(' ');
                item = "";
                foreach(string st in itemArr)
                {
                    if(st.Equals("at")){
                        item += "@";
                        continue;
                    }
                    item += st;
                }
                sb.AppendLine(SetAlignment("LEFT") + "  " + FormatStringAlignment(detail.Qty.ToString(),"LEFT"));
                sb.AppendLine(SetAlignment("RIGHT") + FormatStringAlignment(item,"RIGHT") + FormatStringAlignment(detail.Amount.ToString("N2"),"LEFT"));
                storebottle += detail.StoreBottleQty;
                storecap += detail.StoreCapQty;
            }
            sb.AppendLine("");
            sb.AppendLine("");
            sb.Append(SetAlignment("CENTER"));
            sb.AppendLine(header.TotalQty.ToString() + " ITEMS");
            sb.Append(SetAlignment("LEFT"));
            sb.AppendLine("");
            sb.AppendLine("   STORE CAP: " + storecap);
            sb.AppendLine("STORE BOTTLE: " + storebottle);
            sb.AppendLine("");
            sb.Append(SetAlignment("RIGHT"));

            sb.AppendLine("  TOTAL: " + FormatStringAlignment(header.AmountDue.ToString("N2"),"RIGHT"));
            sb.AppendLine("DEPOSIT: " + FormatStringAlignment(header.AmountTender.ToString("N2"),"RIGHT"));
            sb.AppendLine("BALANCE: " + FormatStringAlignment((header.AmountDue - header.AmountTender).ToString("N2"),"RIGHT"));

            PrintFooter(ref sb);
            sb.Append(CutPaper());
        }
        private static void PrintClaimSlip(ref StringBuilder sb, LaundryHeaderDataEntity header, CompanyDataEntity company)
        {
            string[] itemArr;
            string item;

            PrintHeader(ref sb, company);
            sb.Append(SetFontSize(2));
            sb.AppendLine("CLAIM SLIP");
            sb.Append(SetFontSize(0));
            sb.AppendLine("");
            sb.Append(SetAlignment("LEFT"));
            sb.AppendLine("SO# :           " + header.LaundryHeaderID.ToString());
            sb.AppendLine("CUSTOMER :      " + header.Customer.Name.ToUpper());
            sb.AppendLine("DATE RECEIVED : " + header.ReceivedDate.ToShortDateString());
            sb.AppendLine("DATE DUE :      " + header.DueDate.ToShortDateString());
            sb.AppendLine("");

            sb.AppendLine("#OF ITEMS      KLS.        " + SetAlignment("RIGHT") +
                 "ITEM           TOTAL");

            foreach(LaundryDetailDataEntity detail in header.DetailEntities)
            {
                itemArr = detail.Service.Name.Split(' ');
                item ="";
                foreach(string st in itemArr)
                {
                    if(!st.Equals("-")){
                       	item += st.Substring(0,1);
                    }
                }
                item += "-";
                itemArr = detail.Category.Name.Split(' ');
                foreach(string st in itemArr){
                    item += st.Substring(0,1);
                }

                sb.AppendLine(SetAlignment("LEFT") + "  " + FormatStringAlignment(detail.ItemQty.ToString(), "LEFT")  + FormatStringAlignment(detail.Kilo.ToString(),"LEFT"));
                sb.AppendLine(SetAlignment("RIGHT") + FormatStringAlignment(item,"RIGHT") + FormatStringAlignment(detail.Amount.ToString("N2"),"RIGHT"));

            }
            sb.AppendLine("");
            sb.AppendLine("");
            sb.Append(SetAlignment("CENTER"));
            sb.AppendLine(header.TotalItemQty.ToString() + " ITEMS");
            sb.Append(SetAlignment("RIGHT"));
            sb.AppendLine("");
            sb.AppendLine("");

            sb.AppendLine("  TOTAL: " + FormatStringAlignment(header.TotalAmountDue.ToString("N2"),"RIGHT"));
            sb.AppendLine("DEPOSIT: " + FormatStringAlignment(header.TotalPayment.ToString("N2"),"RIGHT"));
            sb.AppendLine("BALANCE: " + FormatStringAlignment((header.TotalAmountDue - header.TotalPayment).ToString("N2"),"RIGHT"));
            PrintFooter(ref sb);
            sb.Append(CutPaper());
        }
        public static bool PrintRefillSlip(PrinterDataEntity printer, RefillHeaderDataEntity header, CompanyDataEntity company)
        {
            try{
                SetPrinter(printer);
                if (ps == null) return false;

                StringBuilder sb = new StringBuilder();
                PrintRefillOrderSlip(ref sb, header,company);

                RawPrinterHelper.SendStringToPrinter(ps.PrinterName, sb.ToString());
                return true;
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }
        public static bool PrintLaundrySlip(PrinterDataEntity printer, LaundryHeaderDataEntity header, CompanyDataEntity company)
        {
            try{
                SetPrinter(printer);
                if (ps == null) return false;

                StringBuilder sb = new StringBuilder();
                PrintClaimSlip(ref sb, header, company);
                RawPrinterHelper.SendStringToPrinter(ps.PrinterName, sb.ToString());

                sb = new StringBuilder();
                PrintTag(ref sb, header);
                ps.Copies = 1;
                RawPrinterHelper.SendStringToPrinter(ps.PrinterName, sb.ToString());
                return true;
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }