コード例 #1
0
        public ActionResult Voucher()
        {
            DtoVoucher voucher = new DtoVoucher {
                StartDate = DateTime.Now, EndDate = DateTime.Now
            };

            return(View(voucher));
        }
コード例 #2
0
        public DataTable GetVouchers(DtoVoucher voucher)
        {
            DataTable Vouchers = new DataTable();

            if (voucher.WithoutDate)
            {
                Vouchers = (from v in _db.AccVouchers
                            join A in _db.AccAccounts on v.AccString equals A.AccString
                            where v.VNo.Equals(voucher.VId)
                            orderby v.VSrNo
                            select new
                {
                    v.VDate,
                    A.AccName,
                    v.VDescription,
                    v.VSrNo,
                    v.Debit,
                    v.Credit,
                    v.VNo,
                    v.VType,
                    v.UserCode,
                    v.InvNo,
                    v.InvType,
                    DCType =
                        (Decimal)((Decimal?)v.Debit ?? (Decimal?)0) > 0 ? "Debit Details" :
                        (Decimal)((Decimal?)v.Credit ?? (Decimal?)0) > 0 ? "Credit Details" : null
                }).ToList().ToDataTable();
            }
            else
            {
                Vouchers = (from v in _db.AccVouchers
                            join A in _db.AccAccounts on v.AccString equals A.AccString
                            where v.VNo.Equals(voucher.VId) && v.VDate >= voucher.StartDate && v.VDate <= voucher.EndDate
                            orderby v.VSrNo
                            select new
                {
                    v.VDate,
                    A.AccName,
                    v.VDescription,
                    v.VSrNo,
                    v.Debit,
                    v.Credit,
                    v.VNo,
                    v.VType,
                    v.UserCode,
                    v.InvNo,
                    v.InvType,
                    DCType =
                        (Decimal)((Decimal?)v.Debit ?? (Decimal?)0) > 0 ? "Debit Details" :
                        (Decimal)((Decimal?)v.Credit ?? (Decimal?)0) > 0 ? "Credit Details" : null
                }).ToList().ToDataTable();
            }

            return(Vouchers);
        }
コード例 #3
0
        public void InsertarVoucher(DtoVoucher Objvoucher)
        {
            SqlCommand cmd = new SqlCommand("SP_InsertarVoucher", conexion);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@numvoucher", Objvoucher.PK_VV_NumVoucher);
            cmd.Parameters.AddWithValue("@importe", Objvoucher.DV_ImporteDepositado);
            cmd.Parameters.AddWithValue("@comentario", Objvoucher.VV_Comentario);
            conexion.Open();
            cmd.ExecuteNonQuery();
            conexion.Close();
        }
コード例 #4
0
        public void DetallesVoucherSolicitudUsuario(DtoVoucher objdtoVoucher, DtoSolicitud objDtoSolicitud, DtoMolduraxUsuario objDtoMolduraxUsuario)
        {
            //SqlCommand command = new SqlCommand("SP_DetallesVoucherUsuarioxSolicitud", conexion);
            //command.CommandType = CommandType.StoredProcedure;
            //command.Parameters.AddWithValue("@dni",objDtoMolduraxUsuario.FK_VU_Cod);
            //command.Parameters.AddWithValue("@idsol", objDtoSolicitud.PK_IS_Cod);
            //DataSet ds = new DataSet();
            //conexion.Open();
            //SqlDataAdapter moldura = new SqlDataAdapter(command);
            //moldura.Fill(ds);
            //moldura.Dispose();

            //SqlDataReader reader = command.ExecuteReader();

            //while (reader.Read())
            //{
            //    objDtoSolicitud.DTS_FechaEmicion = Convert.ToDateTime(reader[0].ToString());
            //    objdtoVoucher.PK_VV_NumVoucher = reader[1].ToString();
            //    objdtoVoucher.VBV_Foto = (byte[])reader[2];
            //    objdtoVoucher.DV_ImporteDepositado = Convert.ToInt32(reader[3].ToString());
            //}
            //conexion.Close();
            //conexion.Dispose();
            SqlCommand command = new SqlCommand("SP_DVS", conexion);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@idsol", objDtoSolicitud.PK_IS_Cod);
            DataSet ds = new DataSet();

            conexion.Open();
            SqlDataAdapter moldura = new SqlDataAdapter(command);

            moldura.Fill(ds);
            moldura.Dispose();

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                objdtoVoucher.VBV_Foto             = Encoding.ASCII.GetBytes(reader[0].ToString());
                objDtoSolicitud.DTS_FechaEmicion   = Convert.ToDateTime(reader[1].ToString());
                objdtoVoucher.PK_VV_NumVoucher     = reader[2].ToString();
                objdtoVoucher.DV_ImporteDepositado = Double.Parse(reader[3].ToString());
            }
            conexion.Close();
            conexion.Dispose();
        }
コード例 #5
0
ファイル: DaoVoucher.cs プロジェクト: anixlover/SCPEDR_2K20
        public bool SelectPagoVoucher(DtoVoucher v)
        {
            string     Select    = "SELECT * from T_Voucher where PK_VV_NumVoucher ='" + v.PK_VV_NumVoucher + "'";
            SqlCommand unComando = new SqlCommand(Select, conexion);

            conexion.Open();
            SqlDataReader reader       = unComando.ExecuteReader();
            bool          hayRegistros = reader.Read();

            if (hayRegistros)
            {
                v.VBV_Foto             = (byte[])reader[1];
                v.DV_ImporteDepositado = Convert.ToDouble(reader[2].ToString());
            }
            conexion.Close();
            return(hayRegistros);
        }
コード例 #6
0
        public ActionResult Voucher(DtoVoucher voucher)
        {
            voucher.EndDate = voucher.EndDate.AddDays(1);
            var vouchers = _repo.GetVouchers(voucher);

            vouchers.TableName = "Ledger";
            //return Json(new {data = Ledgers}, JsonRequestBehavior.AllowGet);

            ReportViewer reportViewer = new ReportViewer();

            reportViewer.ProcessingMode      = ProcessingMode.Local;
            reportViewer.SizeToReportContent = true;
            reportViewer.Width  = Unit.Percentage(900);
            reportViewer.Height = Unit.Percentage(900);


            reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\Voucher.rdlc";
            reportViewer.LocalReport.DataSources.Add(new ReportDataSource("Voucher", vouchers));

            ViewBag.ReportViewer = reportViewer;
            ViewBag.ReportTitle  = "Ledger";
            return(View("_ReportView"));
        }
コード例 #7
0
    protected void btnEnviar_Click(object sender, EventArgs e)
    {
        Log _Log = new Log();

        try
        {
            objfacturaneg = new CtrDatoFactura();
            objfactura    = new DtoDatoFactura();
            objpago       = new DtoPago();
            objpagoneg    = new CtrPago();
            objsol        = new DtoSolicitud();
            objsolneg     = new Ctr_Solicitud();
            objvou        = new DtoVoucher();
            objvouneg     = new CtrVoucher();
            int ultimo = objfacturaneg.ultimo();

            if (valorObtenidoRBTN.Value != "1" && valorObtenidoRBTN.Value != "2")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'Seleccione BOLETA o FACTURA!!'});", true);
                return;
            }
            if (txtImporte.Text == "" | txtNumOp.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'Complete espacios en BLANCO!!'});", true);
                return;
            }
            if (txtnewRUC.Text == "" && valorCheck.Value == "3" && valorObtenidoRBTN.Value == "2")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'Complete espacios en BLANCO!!'});", true);
                return;
            }
            if (ddlRUC.Text == "" && valorObtenidoRBTN.Value == "2" && valorCheck.Value != "3")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'Complete espacios en BLANCO!!'});", true);
                return;
            }

            objsol.PK_IS_Cod           = Convert.ToInt32(Session["idSolicitudPago"].ToString());
            objfactura.PK_IDF_Cod      = ultimo + 1;
            objfactura.VDF_RazonSocial = "";
            objfactura.FK_VU_DNI       = Session["DNIUsuario"].ToString();
            if (valorObtenidoRBTN.Value == "2" && valorCheck.Value == "3")
            {
                objpago.IP_TipoCertificado = 2;
                objpago.VP_RUC             = txtnewRUC.Text;
                objfactura.IDF_RUC         = txtnewRUC.Text;
            }
            if (valorObtenidoRBTN.Value == "2" && valorCheck.Value != "3")
            {
                objpago.VP_RUC             = ddlRUC.Text;
                objpago.IP_TipoCertificado = 2;
            }
            if (valorObtenidoRBTN.Value == "1")
            {
                objpago.VP_RUC             = "";
                objpago.IP_TipoCertificado = 1;
            }
            objpago.FK_IS_Cod        = Convert.ToInt32(Session["idSolicitudPago"].ToString());
            objpago.DP_ImportePagado = Convert.ToDouble(txtImporte.Text);
            double costo = objpagoneg.Costo(objpago);

            objpago.DP_ImporteRestante = costo - Convert.ToDouble(txtImporte.Text);

            if (Convert.ToDouble(txtImporte.Text) == (costo / 2))
            {
                objpago.IP_TipoPago = 1;
            }
            if (Convert.ToDouble(txtImporte.Text) > (costo / 2) | Convert.ToDouble(txtImporte.Text) == costo)
            {
                objpago.IP_TipoPago = 2;
            }
            objvou.PK_VV_NumVoucher     = txtNumOp.Text;
            objvou.DV_ImporteDepositado = Convert.ToDouble(txtImporte.Text);
            objvou.VV_Comentario        = "";

            if (hftxtimg.Value == "vacio")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'suba la IMAGEN!!'});", true);
                return;
            }
            else
            {
                _Log.CustomWriteOnLog("ImagenGuardada", "EL CAMPO ESTA LLENO");
            }
            objpagoneg.RegistrarPago(objpago);
            mostrarmsjPAGO(objpago);
            if (objpago.error == 77 && valorCheck.Value == "3" && valorObtenidoRBTN.Value == "2")
            {
                objfacturaneg.RegistrarDatoFactura(objfactura);
                mostrarmsjFACTURA(objfactura);
                _Log.CustomWriteOnLog("RealizarCompra.cs", "Ruc registrado");
                objvouneg.RegistrarVoucher(objvou);
                _Log.CustomWriteOnLog("RealizarCompra.cs", "2");
                Utils.AddScriptClientUpdatePanel(UpdatePanel1, "uploadFileImagenVoucher('" + objvou.PK_VV_NumVoucher + "');");
                _Log.CustomWriteOnLog("RealizarCompra.cs", "3");
                objsolneg.ActualizarEstado(objsol);
            }
            if (objpago.error == 77 && valorObtenidoRBTN.Value == "2" && valorCheck.Value != "3")
            {
                _Log.CustomWriteOnLog("RealizarCompra.cs", "Ruc registrado");
                objvouneg.RegistrarVoucher(objvou);
                _Log.CustomWriteOnLog("RealizarCompra.cs", "2");
                Utils.AddScriptClientUpdatePanel(UpdatePanel1, "uploadFileImagenVoucher('" + objvou.PK_VV_NumVoucher + "');");
                _Log.CustomWriteOnLog("RealizarCompra.cs", "3");
                objsolneg.ActualizarEstado(objsol);
            }
            if (objpago.error == 77)
            {
                _Log.CustomWriteOnLog("RealizarCompra.cs", "1");
                objvouneg.RegistrarVoucher(objvou);
                _Log.CustomWriteOnLog("RealizarCompra.cs", "2");
                Utils.AddScriptClientUpdatePanel(UpdatePanel1, "uploadFileImagenVoucher('" + objvou.PK_VV_NumVoucher + "');");
                _Log.CustomWriteOnLog("RealizarCompra.cs", "3");
                objsolneg.ActualizarEstado(objsol);
            }
        }
        catch (Exception ex)
        {
            _Log.CustomWriteOnLog("RealizarCompra.cs", "error   " + ex.Message);
        }
    }
コード例 #8
0
ファイル: CtrVoucher.cs プロジェクト: anixlover/SCPEDR_Final
 public bool hayVoucher(DtoVoucher voucher)
 {
     return(objvoucherdao.SelectPagoVoucher(voucher));
 }
コード例 #9
0
ファイル: CtrVoucher.cs プロジェクト: anixlover/SCPEDR_Final
 public void DetallesVoucherSolicitudUsuario(DtoVoucher objdtoVoucher, DtoSolicitud objDtoSolicitud, DtoMolduraxUsuario objDtoMolduraxUsuario)
 {
     objvoucherdao.DetallesVoucherSolicitudUsuario(objdtoVoucher, objDtoSolicitud, objDtoMolduraxUsuario);
 }
コード例 #10
0
ファイル: CtrVoucher.cs プロジェクト: anixlover/SCPEDR_Final
 public void RegistrarVoucher(DtoVoucher voucher)
 {
     objvoucherdao.InsertarVoucher(voucher);
 }