Example #1
0
        public OrderRowDefinitions.OwnFee[] getAllOwnFee(string onr, string aidid)
        {
            OrderRowDefinitions.OwnFee ord = new OrderRowDefinitions.OwnFee();
            ArrayList al = new ArrayList();
            Definitions.Aid aid = getAid(onr, aidid, true);

            foreach (Definitions.OrderRowDefinitions.OrderRow o in aid.OrderRows)
            {
                if (GCF.noNULL(o.Artikel).Equals("EA"))
                {
                    ord = new OrderRowDefinitions.OwnFee();
                    ord.AidId = o.AidNr;
                    ord.OrderNo = o.OrderNo;
                    ord.RowNo = o.Rad;
                    if (o.Levstatus.Equals("5"))
                        ord.Delivered = true;
                    else
                        ord.Delivered = false;
                    ord.Amount = GCF.stringToDouble(o.APris);
                    oText.findOwnFeeConnection(o.OrderNo, o.Rad, ref ord);
                    findOH(ord.PatientsOrderNo);
                    ord.PaymentTerms = aid.PaymentTerms;
                    al.Add(ord);
                }
            }

            return (OrderRowDefinitions.OwnFee[])al.ToArray(typeof(OrderRowDefinitions.OwnFee));
        }
Example #2
0
        public bool creditAid(string onr, string aid, CreditType ctor)
        {
            OrderRowDefinitions.OwnFee ownfee = new OrderRowDefinitions.OwnFee();
            bool bOK = false;

            switch (ctor)
            {
                case CreditType.OnlyPatient:
                    ownfee = getPatientsOwnFeeOrderNo(onr, aid);
                    if (ownfee.OrderNo != null)
                    {
                        OwnFee of = new OwnFee();
                        OwnFee.OwnFeeResult ofr = of.creditRowOnPatientsOrder(ownfee.PatientsOrderNo, ownfee.PatientsRowNo);
                        orText.addOwnFeeConnection(ofr.OrderNo, ofr.OrderRow, onr.PadRight(6) + " - " + aid + " (hjälpmedelsid)");

                        try
                        {
                            if (ECS.noNULL(ownfee.PaymentTerms).Equals(Config.BetVillkEaKont))
                            {
                                //Config con = new Config(mBolag);
                                string[] s = Config.getReceipt().Split('-');
                                string mDokGen = s[0];
                                string mReport = s[1];
                                printInvoice(s[0], s[1], ofr.FsNo);
                            }
                            else
                            {
                                //Config con = new Config(mBolag);
                                string[] s = Config.getInvoice().Split('-');
                                string mDokGen = s[0];
                                string mReport = s[1];
                                printInvoice(s[0], s[1], ofr.FsNo);
                            }
                        }
                        catch (Exception ex)
                        {
                            Log4Net.Logger.loggError(ex, "Problem when printing after creation of credit on OnlyPatient", Config.User, "");
                        }

                        bOK = true;
                    }
                    break;
                case CreditType.OnlyInvoiceCustomer:
                    creditAidOnOriginalOrder(onr, aid);
                    bOK = true;
                    break;
                case CreditType.Both:
                    ownfee = getPatientsOwnFeeOrderNo(onr, aid);
                    if (ownfee.OrderNo != null)
                    {
                        OwnFee of = new OwnFee();
                        OwnFee.OwnFeeResult ofr = of.creditRowOnPatientsOrder(ownfee.PatientsOrderNo, ownfee.PatientsRowNo);
                        orText.addOwnFeeConnection(ofr.OrderNo, ofr.OrderRow, onr.PadRight(6) + " - " + aid + " (hjälpmedelsid)");

                        try
                        {
                            if (ECS.noNULL(ownfee.PaymentTerms).Equals(Config.BetVillkEaKont))
                            {
                                //Config con = new Config(mBolag);
                                string[] s = Config.getReceipt().Split('-');
                                string mDokGen = s[0];
                                string mReport = s[1];
                                printInvoice(s[0], s[1], ofr.FsNo);
                            }
                            else
                            {
                                //Config con = new Config(mBolag);
                                string[] s = Config.getInvoice().Split('-');
                                string mDokGen = s[0];
                                string mReport = s[1];
                                printInvoice(s[0], s[1], ofr.FsNo);
                            }
                        }
                        catch (Exception ex)
                        {
                            Log4Net.Logger.loggError(ex, "Problem when printing after creation of credit on Both", Config.User, "");
                        }

                        bOK = true;
                        creditAidOnOriginalOrder(onr, aid);
                    }
                    break;
                default:
                    break;
            }
            return bOK;
        }
Example #3
0
        public OrderRowDefinitions.OwnFee getPatientsOwnFeeOrderNo(string onr, string aid)
        {
            OrderRowDefinitions.OwnFee[] ownfees = mOR.getAllOwnFee(onr, aid);
            OrderRowDefinitions.OwnFee ownfee = new OrderRowDefinitions.OwnFee();

            if (ownfees.Length > 1)
            {
                frmOwnFeeList oOfl = new frmOwnFeeList();
                oOfl.ownfees = ownfees;
                oOfl.ShowDialog();
                ownfee = oOfl.selectedOwnFee;
                oOfl.Dispose();
                GC.Collect();
            }
            else
                if (ownfees.Length == 1)
                    ownfee = ownfees[0];

            return ownfee;
        }
Example #4
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if(lwOwnFees.SelectedItems.Count > 0)
     selectedOwnFee = ownfees[lwOwnFees.SelectedItems[0].Index];
 }