protected override void Print()
        {
            var ds    = new DS_CashboxOrder();
            var table = ds.T_Cashbox;

            table.AddEmptyRow();
            table[0].ID         = ConvertHelper.ToInt32(ID);
            table[0].Company    = GlobalVariable.MyCompanyName;
            table[0].Branch     = lookBranch.Text;
            table[0].ActNumber  = ActNumber;
            table[0].OrderDate  = dateOrderDate.DateTime.Date;
            table[0].SubAccount = SubAccount;
            table[0].AnalyticalAccountingCode = AnalyticalAccountingCode;
            table[0].Amount = Amount;

            table[0].CurrencySymbol = NumToStrHelper.ToCurrencySymbol(lookCurrency.Text);
            table[0].AmountToStr    = NumToStrHelper.CurrToStr(Amount, NumToStrHelper.ToCurrencyName(lookCurrency.Text), NumToStrHelper.ToCurrencyMinorUnit(lookCurrency.Text));

            table[0].SpecialPurposeCode = SpecialPurposeCode;
            table[0].IssuedPerson       = bbPerson.Text;
            var person = PersonManager.GetPerson(IssuedPersonID);

            if (person.Count > 0)
            {
                table[0].IssuedPersonPersonalNumber = person[0].PersonalNumber;
            }
            table[0].Basis         = lookBasis.Text;
            table[0].Enclosure     = Enclosure;
            table[0].WarrantNumber = WarrantNumber;

            Zek.Report.ReportHelper.Show(MdiParent, Text, Reports.ReportName.CashboxOrder, ds);
        }
        public static DS_Currency.DD_CurrencyDataTable GetCurrencies(DS_Dictionary.SP_GetDictionaryDataTable table)
        {
            var result = new DS_Currency.DD_CurrencyDataTable();

            foreach (var row in table)
            {
                result.AddDD_CurrencyRow(result.Count + 1, row.ID, NumToStrHelper.ToCurrencyName(row.ID), NumToStrHelper.ToCurrencyMinorUnit(row.ID), NumToStrHelper.ToCurrencySymbol(row.ID), ConvertHelper.ToDecimal(row[table.CodeColumn]));
            }

            return(result);
        }
Exemple #3
0
        private void Print(Reports.ReportName reportName)
        {
            try
            {
                Application.DoEvents();
                Cursor = Cursors.WaitCursor;

                var rate1     = DictionaryManager.GetCurrencyRate(CurrencyCode, StartDate);
                var rate2     = DictionaryManager.GetCurrencyRate(GlobalVariable.MyCompanyConditionalUnitCurrencyCode, StartDate);
                var crossRate = rate2 / rate1;

                var ds = new Zek.DataModel.DS_TradeOrder();
                Zek.DataModel.DS_TradeOrder.T_HeaderRow hrow = ds.T_Header.NewT_HeaderRow();
                hrow.HeaderID            = ProductDistributionID;
                hrow.OrderNumber         = ProductDistributionID.ToString();
                hrow.OrderDate           = StartDate;
                hrow.SubTotal            = SubTotal;
                hrow.VATAmt              = TaxAmt;
                hrow.Freight             = Freight;
                hrow.TotalDue            = TotalDue;
                hrow.CurrencyCode        = CurrencyCode;
                hrow.CurrencyName        = NumToStrHelper.ToCurrencyName(CurrencyCode);
                hrow.CurrencyCoin        = NumToStrHelper.ToCurrencyCoin(CurrencyCode);
                hrow.CurrencyRate        = rate2;
                hrow.ProductCurrencyRate = rate2;

                hrow.VendorName    = GlobalVariable.MyCompanyName + " (" + lookFromBranch.Text + ")";
                hrow.VendorTaxCode = GlobalVariable.MyCompanyTaxCode;
                hrow.VendorAddress = GlobalVariable.MyCompanyAddress;
                hrow.VendorPhone   = GlobalVariable.MyCompanyPhone;

                hrow.CustomerName    = GlobalVariable.MyCompanyName + " (" + lookToBranch.Text + ")";
                hrow.CustomerTaxCode = GlobalVariable.MyCompanyTaxCode;
                hrow.CustomerAddress = GlobalVariable.MyCompanyAddress;
                hrow.CustomerPhone   = GlobalVariable.MyCompanyPhone;

                var fromBranch = BranchManager.Get(FromBranchID);
                if (fromBranch.Count > 0)
                {
                    hrow.ShipperName    = GlobalVariable.MyCompanyName + " (" + fromBranch[0].Name + ")";
                    hrow.ShipperTaxCode = GlobalVariable.MyCompanyTaxCode;
                    hrow.ShipperAddress = fromBranch[0].Address;
                    hrow.ShipperPhone   = fromBranch[0].Phone;

                    hrow.VendorAddress = hrow.ShipperAddress;
                    hrow.VendorPhone   = hrow.ShipperPhone;
                }

                var toBranch = BranchManager.Get(ToBranchID);
                if (toBranch.Count > 0)
                {
                    hrow.ShipToName    = GlobalVariable.MyCompanyName + " (" + fromBranch[0].Name + ")";
                    hrow.ShipToTaxCode = GlobalVariable.MyCompanyTaxCode;
                    hrow.ShipToAddress = toBranch[0].Address;
                    hrow.ShipToPhone   = toBranch[0].Phone;

                    hrow.CustomerAddress = hrow.ShipToAddress;
                    hrow.CustomerPhone   = hrow.ShipToPhone;
                }


                ds.T_Header.AddT_HeaderRow(hrow);


                if (!string.IsNullOrEmpty(GlobalVariable.MyCompanyBankName))
                {
                    ds.T_Header[0].VenderBankInfo = GlobalVariable.MyCompanyBankName;
                }
                if (!string.IsNullOrEmpty(GlobalVariable.MyCompanyBankCode))
                {
                    ds.T_Header[0].VenderBankInfo += ", კოდი " + GlobalVariable.MyCompanyBankCode;
                }
                if (!string.IsNullOrEmpty(GlobalVariable.MyCompanyBankAccountNumber))
                {
                    ds.T_Header[0].VenderBankInfo += ", ა/ა " + GlobalVariable.MyCompanyBankAccountNumber;
                }
                ds.T_Header[0].VenderBankInfo = ds.T_Header[0].VenderBankInfo.TrimStart(' ', ',');



                var i = 1;
                foreach (var row in ds_Production.SP_GetProductDistributionDetail)
                {
                    Zek.DataModel.DS_TradeOrder.T_DetailRow newRow = ds.T_Detail.NewT_DetailRow();
                    newRow.HeaderID    = ProductDistributionID;
                    newRow.DetailID    = i++;
                    newRow.Line        = row.OrdinalNumber;
                    newRow.ProductName = row.MedicamentName;
                    if (!row.IsSerieNull())
                    {
                        newRow.Serie = row.Serie;
                    }
                    newRow.Quantity    = row.DistributeQty;
                    newRow.UnitMeasure = "ცალი";
                    newRow.UnitPrice   = row.UnitPrice;
                    newRow.StockedQty  = row._ResidualQty;
                    newRow.PackQty     = row.UnitsInStock;
                    if (!row.IsValidDateNull())
                    {
                        newRow.ValidDate = row.ValidDate;
                    }
                    newRow.Manufacturer = (!row.IsBrandNameNull() ? row.BrandName + " " : string.Empty);
                    if (!row.IsCountryNameNull())
                    {
                        newRow.ManufactureCountry = row.CountryName;
                    }

                    ds.T_Detail.AddT_DetailRow(newRow);
                }

                Zek.Report.ReportHelper.Show(MdiParent, Text, reportName, ds);
                //ReportViewerForm.Show(MdiParent, Text, reportName, ds);
            }
            catch (Exception ex)
            {
                ExceptionHelper.Show(this, ex, "შეცდომა ამობეჭვდისას", MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }