Пример #1
0
        public string InsertarFacturaDetalles()
        {
            string msj = "";

            for (int i = 0; i < orden_dtg.Rows.Count; i++)
            {
                F.idProducto   = Convert.ToInt32(orden_dtg.Rows[i].Cells[5].Value);
                F.Cantidad     = Convert.ToDouble(orden_dtg.Rows[i].Cells[1].Value);
                F.idTipoUnidad = Convert.ToInt32(orden_dtg.Rows[i].Cells[6].Value);
                F.Precio       = Convert.ToDouble(orden_dtg.Rows[i].Cells[2].Value);
                F.SubTotal     = Convert.ToDouble(orden_dtg.Rows[i].Cells[3].Value);
                msj            = F.RegistrarFacturaDetalles();
                if (msj != "0")
                {
                    msj = "OK";
                    Program.GtipoProductoId = Convert.ToInt32(orden_dtg.Rows[i].Cells[7].Value);
                    string restarMsj = RestarInventario(Convert.ToInt32(orden_dtg.Rows[i].Cells[5].Value), Convert.ToDouble(orden_dtg.Rows[i].Cells[1].Value));
                    if (restarMsj != "1")
                    {
                        MessageBox.Show(restarMsj, "Sistema Facturación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    return(msj);
                }
            }
            return(msj);
        }