Você está na página 1de 129
SISTEMA DE COMPRA Y VENTA . SISTEMA DE C VENT. ESTE ES UN PROYECTO HECHO EN VISUAL BASIC 2010 CON SOL SERVER 2005, El proyecto estd orientada hacia todas las personas que quieran disponer de ideas, conocimientos, ejemplos y una visi6n teenaligica de lo que concieme a lo que es un sistema, que esta codificado para soportar todo tips de acciones del usuario en general E-mail *royerstudios@hotmail. com *Blog http://www royerstudias. blogspat.com Facebook sroyerstudios EMA DE COI TA Lo primero tenemos que hacer es crear nuestra base de datos con sus respectivas tablas: Base dedatos: CREATE DATABASE FACTURA go USE FACTURA eo & Tablas ¥ Usuario: CREATE TABLE USUARIO! USUARIG VARCHAR (50) CLAVE VARCHAR (50 Y Cliente: CREATE TABLE CLIEMTE IDCLIENTE VARCHAR (50), HOMBRE: VARCHAR (£0) , APELLIDO VARCHAR (50) , DIRECCION VARCHAR (80 TELEFONO VARCHAR (50), GIL VARCHAR (50 FECHA DATETIME ¥ Proveedor: CREATE TABLE PROVEEDOR | TDPROVEEDOR VARCHAR (50), EMPRESA VARCHAR (50), DIRECCION VARCHAR (59), TELEFONO VARCHAR (50) , (CELULAR VARCHAR (50), FAX VARCHAR (50), EMAIL VARCHAR(50), RUC VARCHAR (50), FECHA DATETIME | SISTEMA DE COMPRA Y VENTA ¥ Anticulos: CREATE TABLE ARTICULOS | CODIGD VARCHAR (59). NOMBRE VARCHAR (50). PRECIO VARCHAR (50), STOCK VARCHAR |S9) ¥ Compra: CREATE TABLE COMPRA HROFACTURA VARCHAR (50) . IDPROVEEDOR VARCHAR ($9), SUBTOTAL CHAR (10), TGV CHAR(10). TOTAL CIAR (10) FECHA DATETIME Detalle de Compra: CREATE TABLE DETALLECOMPRA: MROFACTURA VARCHAR (50), DOCHMENTO VARCHAR (50), TDPROVEEDOR VARCHAR (59). EMPRESA VARCHAR (50), CODIGO VARCHAR (50), NOMBRE VARCHAR (50) CANTIDAD VARCHAR (SO), PRECIO VARCHAR (50), IMPORTE VARCHAR (50) v Factura: CREATE TABLE FACTURA, MROFACTURA VARCHAR (50) , IDCLIENTE VARCHAR (50) SUBTOTAL CHAR (19), IGV CHARI10), TOTAL CHAR(10), FECHA DATETIME | SISTEMA DE COMPRA Y VENTA ¥ Detalle de Factura: CREATE TABLE DETTALLEFACTURA( MROFACTURA VARCHAR (59) DOCUMENTO VARCHAR (SO) , IDCLIENTE VARCHAR (50) , NOMBREC VARCHAR (50). CODIGO VARCHAR (50). HOMBRE VARCHAR (50) , CANTIDAD VARCHAR (50) , PRECIO VARCHAR(50) . TMPORTE VARCEAR (5) ’ ¥ Tipe de Decumento: CREATE TRELE TIBODOCUMENTOS ( CODIGO CHAR (3) DESCRIPCION VARCHAR ($0). SERIE CHAR (10), MUMERO CHAR (20) , DESCRIPCION SERIE BOLETA oon ¥ Generador: CREATE TASLE GENERATOR ( PARAMETRO VARCHAR (50), ULTIMO CHAR (4) | EMA DE CO} TA ¥ Temporal Stock: CREATE TABLE TEMPORALSTOCK ( CODIGO CHAR (10), STOCKACTUAL CHAR (30) SELECT + FROM COMPOA MAERE IDFROVIXDOR-BIOPROVETDOR LD (FECHA EETHt = ¥ Venta: CREATE PROC SPFAC SIDCLIENTE VARCHAR 50), arr carer, Qrr carer uM arora SELECT * FROM FACTURR WMERE IOCLIENTE-QrDCLIENTE ED EMA DE COI TA Luego ab rimos nuestro lenguaje de programacién (Visual Basic 2010). Agregamos una clase y dentro de ella vamos a eseribir la conexidn y las variables que vamos a utilizar. ¥ Conexién: 2) Conenon.vt Imports System.Date Imports Spsten.Data.sqlclient Module Conexion ‘variables tipe publica me va ha servir pace mix otros formlarios Public gseRVER as String Public ESTADO As New Boolean Public READER 4s SqlDatateader ‘conexion 2 Is base de datos Public COMEX As Mew SqiConnection(“Data Saurces, :Initial Catalogefacturajuser TDat Public contadar_pata_guarder As Integer Private opataAdapter Az 5q10ataAéapte Private oataTable As DataTable Private eatallow Ac Dazaticn Private oComand8uilder As Sq]Comandtul lier Private PosFilaact as Integer Public ila as Integer = -1 Public TIPO As String = Public € As integer = @ Public pre as Double reportes Public conectarme As Hew SqiGonnect ton Public dataset, dat As few Outset Public adapter, ada At Hew Sql0stakdnpter Public buscar, bus As String End rodule passwordess”) ‘Agregamos una clase y dentro de ella vamos.a escribir los ntimeros que me va.a servir para mostrar el total en laventa dsea que me lea de ndmeros.a letras. ‘SUB-TOTAL avi mo | (ono) (emeaaA) [=m TOTAL \VEINTE 00/100 NUEVO SOLES: DECor TA ¥ Qloumerosvb| |Nodule nuseres Public Function LETRAS(ByUal IMMERO As String) Ar “"DECLARA VARIABLES DE TIPO CADENA Dim PALABRAS, ENTERD, DEC, FLAG As String *°DECLARA VARIABLES (DE TIPO EuTERO*** Dim met, x, ¥ As Integer Fig = "we sss eqiMERD NEGATIVO" IF nid(mmeno, 1,1) = "=" Then MUPERO = MEG(WWMERO, 2, MEAD, ToString. Length - 1).Testring PALABRAS = “REM ~ S050 TIENE CEROS A LA T2QUTERDAS*: For X= 4 Te NUMERO. TeString. Lengeh Tf Hid(MUMERO, 1, 1) = "8" Then NUMERO = Trim(Mid(WUMERO, 2, NUMERO. ToString. Length). TeString) ‘Tf Teim(MUMERD.ToString. Length) = @ Then PALABRAS = ** Else ftxtt For End 2f ext ‘Centinuaeién, “s0eeee=="DIVIDIR PARTE ENTERA ¥ DECIMAL™*=*===0=7> For ¥ = 3 To Len(MUMERO) Tf mid(mmeno, Y, 1) = 7.7 then Fag = “5° Else ‘Tf FLAG = “N” Then ENTERO = + Mid(MUMERO, ¥, 1) Else DEC = DEC + Mid(MMmMERO, ¥, 1) End If End If text ¥ ‘Cantinuacién... If Lam(DEC) = 1 Then DEC = DEC & —— “PROCESO DE CONVERSION® Fug = “Wn Tf wal(MMERO) <= 999999999 Then For Y= Len(ENTERO) Te 2 Step -2 MUR= Len(ENTERD) = (Y ~ 1) Select Case ¥ Case 3, 6, 9 | SISTEMA DE COMPRA Y VENTA ‘Continuacién... **ASIGWA LAS PALABRAS PARA LAS CENTENAS**' Select Case Mid(ENTERO, NUM, 1) Case “1° 1 WLd(ENTERD, MM + 2, 1) = "0" And MLACENTERO, WOH + 2, 1) © PALABRAS = PALABRAS A “CIEW " PALABRAS = PALABRAS A “CTENTO " End If Case *2" PALABRAS = PALABRAS & “DOSCIBNTOS * Case “3” PALABRAS = PALABRAS & “TRESCTENTOS ~ Case "4" PALABRAS = PALABRAS & “CUATROCIENTOS ~ Case “S* PALABRAS = PALABRAS & “QUINTENTOS * Case “6” PALABRAS = PALABRAS & “SETSCTENTOS * fase “7" PALABRAS = PALABRAS & “SETECTENTOS ~ cue "e" PALABRAS = PALABRAS & “OCHOCIENTOS ~ Case “9” PALABRAS = PALABRAS & “WOVECTENTOS ~ End Select Case 2, 5, | SISTEMA DE COMPRA Y VENTA ‘Centinuacién... "ASTGMA LAS PALABRAS PARA LAS DECENAS™ Select Case Mid(ENTERO, MUM, 1) Case "1" Tf MLd(ENTERO, MUM + 1, 1) = “O™ Then FLAG = “S” PALABRAS = PALABRAS & “OIET ~ End tf If Mid(ENTERO, WM 4 1, 1) = “L™ Then FLAG = "S* PALABRAS = PALABRAS & “ONCE ~ End TF Tf MiA(ENTERO, MUM + i, 2) = “2° Then end IF IF MLUCENTERO, MUM + 1, 2) = "3" Then FLAG = “Ss” PALABRAS = PALABRAS B “TRECE “ End Tf Tf MLUCENTERO, MUM + 1, 1) = FLag = “5” PALADRAS = PALABRAS & “CATORCE * end IF Tf MLd(ENTERO, MUM +2, 2) = 5" Then FLAG = “s* PALABRAS * PALABRAS & “QUINCE ~ End If Tf RLACENTERO, NUM 4 1, 2) > “5° Then FLAG = "W PALABRAS = PALABRAS & ~DIECI™ End If ” Then | SISTEMA DE COMPRA Y VENTA ‘Continuacién... Case "2" Tf MEd(ENTERO, MUM + 2, 1) = "O" Then PALABRAS = PALABRAS & “VEINTE * PALABRAS = PALABRAS & “VEINTI" Pua = "Wr End tf case "3" TF RLA(ENTERO, MH + 1, 2) © "0" Then PALABRAS = PALABRAS & "TREINTA ” Fung = 5 Hse PALABRAS FLAG = "Wi tnd Tf Case * Tf MMd(ENTERO, MUM + 2, 2) © “O" Then PALABRAS = PALABRAS A “CUARENTA “ FLAG = else PALABRAS = PALABRAS B "CUARENTA Y rug = 7H tnd IF case “5 ‘TF PAd(ENTERO, MH + 1, 1) = "8" Then PALABRAS = PALABRAS R “CINCUENTA ~ FLAG = *S' se PALABRAS = PALABRAS M “CINCUENTA Y “ FLA = *W tnd IF PALABRAS & “TREINTA ¥ ~ SISTEMA DE COMPRA Y VENTA ‘Continuacién, Care “6 Tf Mid(ENTERO, MUM + 1, PALABRAS FLAG = "5" re PALABRAS = PALABRAS & “SESEWTA Y ~ Fag = "Wr end tf case 77" 1 mid(EnTERO, PALABRAS ~ FLAG = 7 Hse PALABRAS fag = 70" end 7 case “a TY MLACENTERD, MO +3, 2) = 70" Then PALABRAS = PALABRAS & “ocHENTA * FLAG = "6" ese PALABRAS ~ PALABRAS B “OCHENTA ¥. * FLAG = “H" End Tf cose “9 TY Nid(ENTERO, MU + 1, PALABRAS = PALABRAS & "NOVEUTA rag = *5"| Hse PALABRAS = PALABRAS & “NOVENTA Y * FLAS = end 1 End Select a serena vy > DECor TA End 1f Care "2" If FLAG Gare 3" Tf FLAG Case "a" Tf FLAG fase "Ss" Tf FLAG fas Tf FLAG se "7" Tf FLAG Case “o" Tf FLAG case "9" If FLAG End Select End Select = "WY ‘Then PALABRAS © PALABRAS & "OOS “ "WT Then PALABRAS = PALABRAS & “TRES ~ = CMT Then PALABRAS = PALABRAS & “CUATRO” CNT Then PALABRAS = PALAMRAS & “CINCO ~ = THY Then PALABRAS = PALABRAS & “SEIS ~ = "WY Then PALABRAS = PALABRAS & “SIETE ~ = SW" Then PALABRAS = PALABRAS & "OCHO ” = "UY Then PALABRAS = PALABRAS & "IEVE * | SISTEMA DE COMPRA Y VENTA ‘Continuacién... ‘seneeveeereacTOMA LA PALABRA HIL" If Y= 4 Then Ef Mid(ENTERO, 6, 1) <> "0" Or MMA(ENTERO, 5, 1) <> "O” Or MLA(ENTERO, 4, 1) «2 "8" OF _ (Héd{enTERO, 6, 2) = “O° And MEA(EWTERD, 5, 1) = "0" And MLA(ENTERO, 4, 2) = "O° And _ Len(ENTERO) <= 6) Then PALABRAS = PALABRAS “AIL fd If AST A PALABRA HTLLLuretoreessset# Tf ¥e7 then 1¥ Len(ENTERO) » 7 and MEGYENTERO, 1, 1) * “2° Then PALABRAS » PALABRAS B “NaLLGW ® flee PALABRAS » PALABRAS & "HILLONES * end IF End IF Tf DEC @ Then LETRAS = PALABRAS & "CON" 8 DEC Else LETRAS = PALABIAS 2 "06" end If Else Lets =" tnd If End Function End Module | SISTEMA DE COMPRA Y VENTA ‘Agregamos una clase y dentro de ella varnos a eseribir el siguiente eéd go que nos ha permitir que nuestro formulario tanto cliente, proweedor y factura se generen automatiamente. IOCLIENTE | Le) (|_NMEWO wrRoveepoR | _ Pou ) CD nueve Tee Dec EE ¥ |popco0n1 ¥ Ieports System, Data.5qiClient inedule Generar Public dstntorno As New Dstaset Public tipeDecu As String Public coddocu As String ‘Continuacin... Wblie Function GeeerarIDCHiente(Bytal TMA As String) Ax String (he RESWLT As. String » ** fm BEL As <]0aeateader Bim WT as Integer = fm OO As tex SpiComan4("SELECT ULTDWO PRON GENERAONR WHERE PARATETRO = "7 6 TABLAS (CONEK.fpe0() (ORL = OD. Faecutateader tile ORn.tead WT = val(oRu("mTDE") + 2) End hile Comer. Clee() Dim CONS 45 Integer (CORDS = 5 Len(Str(teT)) Select Case (EROS Case 3: RESULT © Left(TAgtA, 1) 6 “eee? 4 Trin(str(u.t)) Cove 2: REGAT = Left(TAMA, 1) + "8" + Tria(Ste(uir)) Case 1; RESULT = Lefr(TASLA, 1) + “S* + Trin(str(weT)) Case @ + SESRT = LeFe{TABLA, 1) 4 7" + TedagSerQety) End Select GenerarTDChionte = RESULT fnd Function DE TA ‘Continuaeién. Public Fawticn Gererarfactura(fyval WBLA Ax String) a5 String Die REGUT ax String =“ ‘Pie DRL As Sel5atateader Din WT As Integer « @ Din OD As lew S:iConmard("SELECT MUPERG FRM TIPODCCUMENTOS WHERE COOIE » '* 4 TARA + *'*, COREX) ted hide oer, Cheee() Din CEROS Au Lotager C2905 © 8 = Lenfsteuer)) Select Case (805 RESULT = Left(THBLA, 1) ¢ "AonmBU” + TeLa(Str(ULT)) MEST © befRGIABLA, 1) + "RINND” + Trielser(WRT})- RESULT = Lefe(TABLA, 1) ¢ “ROBE + Trin(Str(ULT)) AEULT = Left(TABLA, 1) + “eee” + Trin(Str(WLT)) AEST = Lefr{TABLA, 1) + "WH" + TrisiStr(WeT)) RESULT = Left{THBLA, 1) + *W° + TriaiStr(ULT)) RESULT = Lefe(TA@LA, 2) + °° + Teda(ser{utr)) RETRLEE ed Select GecerarFacture » RESLT End Function ‘Continuacién: Public Function GeneraeiOProveederes{2yual TABLA as String) As String (in RESULT is String = Ole DE As Sellatsteate in WT 85 ieteger = @ Din OM 2 tay SeiCommsnd( "SELECT ULTIDO FROM GEKERAOOR WHERE PARARETRO = CORE. Dpe0() ORL = OD. frecuteteader ttle bitt-tead WT = valyBU UTD") + 1) idle oaks“, cone) (E405 » 5 ~ Len(str(uer)) Select Case (EAS RESULT © Left(TABLA, 1) + "880" ¢ Tia(Str(utT)) RESULT = Left(TABLA, 1) + "BH" + Trin(Str{ULT)) AEST = LefR(TABLA, 1) + 70" + Tria(Ste(UkT)) REST = LefR(TABLA, 1) + + Trin(Str(UeT)) End Select Generac IDProveedores = RESULT End Function nd Nodulle | SISTEMA DE COMPRA Y VENTA Luege vamos a crearnuestros respactivos fermularios, = Formularios: ¥ Usuari Imports Systen.Oata Inports Systen.Oste.SqlCLient Public Class usuario Dim ESTADO As New Boolean Dim 11 As String Die 12 As String ¥ Ydentro de! botén aceptarescribimos el siguiente codigo: (tem) Fricate Sus eaduceptar clich(eyial seer Ac Systm. coject, pial @ is Spoten.Evrtirgs) Manes eadaceptar cic bentic contador as Singte in abunear xR String(CTjpe("taact * from unanris sere utaedssful", Cae{)}) hn md As fen Secor qlbutcar, CONEX) (OREL.Opent) ad. Parmmeters A8H(Pel", 9100 ype MiarChar) Value = tetusuteto. Test Din T String » CStr(adtancutecalar()) 1 contador #3 Then aghest"v4 Kabares Let tates") bed nd of FO Lent) = 0 Tee contador » conta # 1 (sO Read) 10» Gaerne ‘vauaric")) a » (Str [REOERY“chave")) eX clese() | SISTEMA DE COMPRA Y VENTA ‘Continuacién... else a FADER = md. ExacuteReader READER.Read() LL = CStr(READER(*wsuario”)) Lz = Cstr(READER(“clave™)) ‘CONEX.Clese() Tf (12 = txtclave.text) Then te usuario.ActiveForm.Hide() Menu_Principal.Statusstriplvisible = True rinchpal, ToolStripStatustabel2, Text: = Me.txtusuario. Text Manu Principal. ToolStripStatusLabel3.Text = Me.txtclave. Text enu_Princtpal :ShowOdalog() contador * contador + 1 Msglox("Ele usuario © contrasefis es incorrecto") txtusuario. Text txtclave.Text = 7" ‘trtusuarie-Focus() End TF End TF ‘tnd Sub ¥- Ydentro del botén cancelar escribimos el siguiente cédigo: Private Sub cadsalir_Click(ayva Me-Close() End Sub ¥ Yeentro do! evento keyPress de la caja de toxte tatusuario escribimes el siguiente eédigo: Private Sub txtusuerio KeyPress(Byval ser Tf e.KeyChar = Cheii(Keys.Enter) Then ‘e.andled = True Me. tutclave. Focus() End 1f End Sub ¥ Ydentro del evento KeyPress de la caja de texto txtelave escribimas el siguiente Sub extelave_KeyPress(oyval sen If eskeyChar = Chril(keys.Enter) The ‘e.Mandled = True Ne cadaceptar.Focus() tnd If End Sub | SISTEMA DE COMPRA Y VENTA REGISTRG DF GLIENTES WweLieNTe ] ed Gee) Louanoan. nomares: | | (weDiFican APriuinos | (cane pinecooN (SANCELAR |] (SERRAR | EMAIL [ Imports Systes.Data Imports System.Data.SqiClient Public Class Clientes Private obatasdapter As Soldat adapter Private oDataTable 2s atotable Private eDataRow As Datation Private oComandtuilder As $91Comandsul Ider Private PosFilaAct As Integer Imports System.Data Imports System.0ata.SqiClient Public Class Clientes Private obetaAdapter As SolOstaadapter Private obataTable As DiteTable Private oDataRow As Dataiow Private oComandtuilder As SqlCommanddut Ider Private PosFilaAct As Integer YY dentro del botén nuevo escribimos el siguiente cédigo: (Caue0 | SISTEMA DE COMPRA Y VENTA Private Sub Buttoni Click(ByVal sender As Syste Call Limpiar() TextBox. Text ~ GenerarI0CLiente("CLIENTE") TextBox. Enabled = False TextBex2.Enabled = True TextBex3.Enabled = True textboxd. Enabled = True TextBexS, Enabled = True TextSox8.enabled = True DateTinePicker].tnabled = True TextBox? Focus) contader_pata_guatdar = 1 Atndivevo. Enabled = False Btnduardar.Enabled = True Beneditar.Enabled = False StnELiminar.Enabled = Fal: benconcelar.Enabled = Teve Bencerrar.tnobled = False Button. Enabled = False Textftoxz. Focus) End Subs “ Ylwoge creamos una funcién de nombre limpiar que nos va.a permiti limpiar las cajas de tetos: Private Sub Lispiar() TextBaxl.Text = tothing ‘TextBon2.Text = Nothing TextBox3. Text = Nothing textboxt. Text = Nothing ‘TextBoxS Text = nothing TextBon§. Text = Nothing DateTinePickerd Text = Nothing TextBoxd.Text = Nothing end Sut ¥ Ydentro del formularioload escribimos el siguiente cidigo: Private Sub Ferm3_Load(Byval sender As System.object, Byval ‘TextBaxi.tnabled = False Textaeudtnabled = False TextBox3.tnabled = False texthaxt.Enabled = Falee TextSoxS.tnabled = False TextBox6.Enabled = False OsteTinePickerl.tnabled = False Btnediter.Enabled = False BenGuardar.tnabled = False Btnéliminer.tnabled = False Button2.Enabled = True cComandBuilder = Hew SqlCcemundilullder (Me.oBateddapter) ePataAdapter © lew 5: l0ataiapter “Select * From Cliente ORDER BY EdCliente™, CONEX) DataTable = New Ostetoble ataAdapter.Fill(cdstaTable) End Sub EMA DE COI SISTEMA DREOMPAY VENTA dome desboxan guard estrtumoses suerte che: ‘sunnan rbvate sub ouctong bic (eyval sen A syste WH tenttecl Tord = hethlng Then tnt BF Peettont tert = tothis et tnt 17 NewtBass.tavt = mothtag Thin tale ae Go YF besten fect = thing Then eit hh ma 17 rewthons ext = wotntng tat FY tentBont fect = nothing then tae uk tnt 17 beterieetceart.text « working Then ins tf then a gers ieee linn eel cece RT =i. oer mex. hese) egoet"uot seten os wedificaren corenctimerts”) ‘ort. taabded = false SISTEMA DE COMPRA Y VENTA ¥ Ydentro del botén cancelar escribimos el siguiente cédigo: (canceuaa Private Sub btacancelar Click(#yval ser Call Limptar() TextBoxt.nabled = False TextBox2.Enabled = False TextBox3.Enabled = False textboxt. Enabled = False TextBox5.tnabled « False TentBox6.Enabled ~ False DateTimePickeri.fnabled = False TextBoxl.Fecus() contador_pata_guardar = 1 Btefvevo.Enabled = True Stneditar.enabled = False BtnEliminar.tnabled = False SenGuardar.tnabled = False btncancelar.tnabled = False Btrkerrer-Enabled = True TextBoxz.Focus() End Sub ¥ Ydentro del botén cerrar excribimos el siguiente eo digo: Btneditar-Snabled = False BinGvardar.Enabled - False BtnEliminar enabled = False Me.Close() End Sub + Ydentro del botén buscar escribimos el siguiente cddig & Private Sub Button?_click 1(Byval ‘Buscar _Cliente.ShowOtalog() end Sub | SISTEMA DE COMPRA Y VENTA ¥ Ydentro de! botén modificar escribimos el siguiente cédigo: [MODIFICA Private Sub Beneditar_Click(8yival TextBoxt. Enabled = True TextBox2, Enabled = True TextBox3.tnabled © True textbexd. Enabled = True Textfioxs. Enabled » True TextBoxé. Enabled » True GaterimePicker].tnabled » True contador_pata_guardar = 2 Sentiuevo. Enabled = False Btneditar.Enabled = False Benguardar. Enabled = True BtnELiminar.tnabled = False End Subs SISTEMA DREOMPAY VENTA 1f- domro es Botan eimiraeexentimen et ipieme cod: nea) lege oh thot £AnACp el ener fa oe ec ate etn Byers) een Mtoe conan. opent) ‘tm tecteaqinarrar as thew String (Crypetaelate rw Citentn starw ttctbentrpesoeetiaiaa”, OowQ)}) SISTEMA DE COMPRA Y VENTA Y Proveedores: eis TRO DE PROWEEDORES IDPROVEEDOR | (Gece) [cusnoan | ewrress | “WoOFCAR | DIRECCION ELIMINAR | : ewe | reeron | ] (cennaa._] cewur | J mx | 1 EMAL [ J Imports Systen.0ata Imports System.Oata.SqiClient Public Clas Praveedores Private oDataddapter As SqlDataadepter Private oGataTable As DateTebl Private oDataRow As Dstsiow Private oComandBuilder As. SqlComandBuilder Private PosFiladct As Integer ¥ y dentro delformulario lad escribimos el siguiente eésige: Private Sub Form4_Load(ByVel sender As SystemChject, ByVal © As System.tventérgs) Handles Myf TextBox1.Enabled = False Textéoxz.tnabled = False TextBex3.tnabled = False TextBoxt. Enabled = False TextBoxS. Enabled ~ False Textéoxé. Enabled = False TextBox? Enabled = False Texthox8.Enabled = False DateTimePickerl. Enabled ~ False Beneditar.cnabled = False StnGuardar.tnabled = False BeneLiminar.Enabled = False Dutton2.tnabled = True eCommandBublder = Hew Sql Comanddullider (Me.oDataAdapter ) oOataAdapter = lew SqDataddapter(“Select * From Proveedor ORDER BY IdProveedor™, CONEX) ‘obeteTable = New DotaTobe F411 (cbataTable) SISTEMA DREOMPAY VENTA # domra desBaten nvewS esontimas expe ca Giese) Prints ts Beers SLEGbCyrol pend Me fynten sit opto) ‘raebentTevt = Gener wEBCLinta(“MOMEEION) ‘extend. totet « Frise extend. tnabied = tre Fevtdenhstetet = Foe Yecthont tabled = oe ertgec. teed = roe ‘ectbent-Coulet © Troe ‘Jerenor?-tuaed + Frat SISTEMA DE COMPRA Y VENTA ¥ Ydentro del botén guardar escribimosel siguiente cédigo: (counoen | Private Sub BtnGuardar Click(Byval kender If Text#oxt.Text = Nothing then ‘Eett Sub End Tf If TextBox2. Text © flothing Then Exit Sub tnd If Tf Tentiloxd. Text = Nothing Then ‘eekt Sub tnd 1 If Textfoxd.Text = Nothing Then ‘Ext Sub End If If TextBox5.Text = Nothing Then eet Sub tnd If If TextBox6. Text = Nothing Ther belt Sub end If If TextBox?.Text © Nothing Then Exit Sub End If If Textbox8.Text = Nothing Then exit Sub tnd tf If DateTimePickerd.Text = Nothing Thea exit Sub End If SISTEMA DREOMPAY VENTA comeuacin.. 1 contidor pata putin ty camx.cpent ie tanta ingreear at ww Serb ctype inert in Proven rr omeder tras 1 cad As em sme tentang, CUA) ‘Teta Txt) Sethe. Tet) he Tere. Tt) Text Tet) i Yerti.Tet) Se Teme) he Tent. tert) se Texto. tet) beT ieee Text) efor mn, i, eal 0B OE 8)", COA) ‘gto ioe aton ve arabe cerectanente*) (in adh A ow seman URDATE SENEUGGR BET LTE = ULTIO + 1 MEME PMA = “PROMEEC, COMER) Teseaat tesla = Fale SutetLevP tert tnabled « Yale contador pata puarar = @ Caen ha Bresette mpon ee esnage) ta ima | teaver peta_puandar = 2-men tr eet ean) Dim beetengiaBininar ss tw Sring(CTypec“update Ormvser set txpresame shore EdProuenornda, Char()7) Dim mtn A few 5c ommyoieytonyeLixinar, COMEX) min. Paraneters.tdeauel Be, he Teee Box TEXEY ei. paraeetersagdedcvaluet 0 (mde. PavaetarsAdutvalun( "fe") e-Tent end. Text} an. Paraneters sdautewralue( "BO", Pe ‘nde. paraceters adituralue("Pe"| eText @0ns- TEE) ‘nex. ciase() faggots Sater oe wabificerm correctemerte") Jestbort. teased = Pelse Jevtmena. Enabled = False Jextsoct enabled = False ‘extend ened = False teveson utes = Hat ‘arent tabled» Pt Siterineectert tat tnd» Palo ‘censor pets puede = earch ex Drei Teele en” 1 Yidernra del ban moda eceb nase! eqiene digs: (hepa) rueate Sab Honeditar_cichC2yyal # “Testhent-feabied = True ‘Testhend tabled = Trve Secttesh thobled = trae Jaettenttrabled © Tour ‘Tentbors trabled = Tre ‘eetheet traded = Tree Beterleeblcbert faabied = Troe ‘conta. pate goardar = 7 ‘mtmotetrabina © Fale | ‘omnia desboxan otmirae esrtimenel iieme cdg: ane Private San atacLintnar Click( yal dander Ae systentbject, Eyal # At sheten.coecirg:) nancies wenebinana co conex open) ote SISTEMA DE COMPRA Y VENTA ¥ Yluego creamos una funciénde nombre limpiar que nos va.a permitirlimpiar las cajas de textos: Private Sub Lispiar() TextBox. Text = lsthing TextBox. Text-= Hothing TextBox}. Text = Nothing ‘textbox4. Text TextBoxS. Text TextBoxs. Text TextBox? Text Textboxt. Text DateTinePickert.Text = Nothing Nothing Wething Wothing Wothing Mothing TextBoxi.Text = Nothing End Sub ¥ Y dentro del botén cancelar escribimos el siguiente cédigo: (caCELAR Private Sub Button2 Click(Byvel. sende all Limpiar() TextBoxl.Enabled - False TextBox. Enabled = False Texttox3.tnabled = False TextGoxd.Enabled = False ‘Textfox.tnabled = false TextBox8.Enabled = False TextBox7.Enabled = False TextBoxt.tnabled = False DateTimePickeri Enabled = False contedor_pata_guardar = 2 Btnieuevo.fnebled = True Btoediter.Enabled = False Btnelininar. Enabled = False Btnduardar enabled = False btncancelar.Enabled = False BtaCerrar.Enabled = True ‘TextBox2.Fecus() End Sub | SISTEMA DE COMPRA Y VENTA ¥ Ydentro del botén cerrar escribimos el siguiente cé digo: (ceameen.) Private Sub Buttoné_CLick(Byvsi Stneditar.fnabled = False StrGuarder. Enabled ~ False BtnEliminar Enabled = False Ne.Close() End Sub + Y dentro del formulariobuscar escribimos el siguiente cé digo: 2 Private Sub Button2 Click 1(Byval ser Buscar Proveedor. Show@ielog() End Sub End Class. REGISTRO DE AATCULOS BNR | co0e0 (a) (ouanoan] Cenran) NOMBRE PRECIO ‘STOCK Imports System.oata Imports System.Data.SqiClient [Pubide Clase articulos Private oOataAdapter As Sqldatacdapter Private ebataTable As OntaTable Private oBatafiow As Uatsfiow Private eCommandBullder As SqlCommnd2uiléer Private PosFilatct As Integer SISTEMA DREOMPAY VENTA Yhuego Games une fueien de non relmipar qué roa pritirmgsaeas ace Sa: Pinata Suk Ltaplar( “Tenth = ethin entiend test © Nothing extend Text = Mething Tete eat = thing wo % vecriaenesdeetsadetborin mac el dquertecédyo: Come) Pebceba Suh nema, CeCe xa ‘Cals Haplar() ‘Terttont trabled = True ‘Testbordtrabied = Tove ‘Tented tabled = rue ‘ecttend tnabled = False ‘Jerttort Foci) fmurtondthabied = Fale TetioedPoeut() | dome esboxan guard estrtimoses suerte che: (anne) Wetyta tuk Watuardar cAkek(eyvst sender ¢ TW" yemumach text nuthin Pan tein a tno 14 ne | comeuacin., 1 cntader_gata_guaedar = 1 Then Tr conse.spen) fim treaeelingreser hn tee dicing typekioeert nt Artin (eign tenon Scholae GBB" Cred) Din cade Mee Saco tentenssingrenar, CONEY) cde, pareerers.settnaue( fe, TextBox tert) (da, areata itsnaue( fe, Pe: TextRend Test) ‘a Paeaeetarsaseedur fe" rw, ented Tet) ‘le, Pareeteors adalat BE, Aa. Faeted testy Gata, tocriamenbery() ‘omen, Chae) Fagton("Let taton oF grater corgctanante”) ‘Nee goen() inte bene) were Tecthontfranied = Fes Teethondthaed = Felne eettendtrabed = ele Testbent tabbed © Foloe oueuiegie Sagbon(es seen) i ir aiteecetateederyt ‘ner clanat) Pegnen "cay tetas 8 maitFLiaron corvertamnte”) ertaeat thahied © False ‘entacnd.tnabiet © False ‘erthendteab led © Palo ‘eetuant teabied = Pala santas pate guardar = @ caton ex An Tocnp in | 17 ion totenebeinac err quiere chao: | 1 Yhuego dia ro ai omulare ladesertimaseisiguecte codgo Petbate Su Fores Coady sender as Systen-ch jew’, aye © 48 System. temas) Mandl “Ferebend tnaaled ~ False Tectia} Encl = Pale Yecttest.PuBled © Pulao eotlet. treet © Pale tnmee. Cred = Poe nerd med = Fats Fiothbetne tnenins » Fate Nettend tnebloa = fom SCommanfalor tan Connor nOgtahdapter SSreteger wt Sst einer fom aren ERR WF Coa, CME) Searatatie + new 220 (Seemenou. ranean 1 demra detbenon buscar ecntioset que ree cago: = retest tp mattand, ce Of tmelboton eerar corti elaguerte cago: rtaata tse Rencarree_€1 samt) tt Sab SISTEMA DE COMPRA Y VENTA ¥ Tipo de Documento: Bre) Tipo Documento Tipo Doc a Imports System, Date Imports System. Data.SqiClient + Dentro del evento load del formulario escribimos el siguiente codigo: Private Sub F_toad(Byval se ‘TEBO_DOCURENTO() End Sub ¥ Creamos una funcién para cargar los tipos de documentos en el combo box: Public Sub TEPO_pOCuMENTO() ‘oh ead As few SqlComond{ "SELECT COOTSO,DESCRIPCLON, SERTE FRaN TIFOOOCLFENTOS", CORK) Dim drt Ax few Sqliatnistapter(emd) im del Ar tiew GaraTahle dei. PiL(@t2) e.Cosbotox?.Oatwsaurce = dtt. e.Conboben?.DLsplaytienber = "DESCRIPCTOR™ Ne.Conboion? Valuelesber = "COOIGO" fhe.Combotioxd.OataSaurce = th ‘e-Conboton}. Valuntionber = “Sekt” end Sub ¥ Dentro dol botdn aceptar escribimos ol siguiente cédigo: Private Sub STM_ACEPTAR_CLick(Byval sender As System.Object, Byval Venta.ComboBax2.Text = Me ComboBox2. Text Venta.ComboBex3. Text = the .CombeBox3. Text ‘Venta.Combofexs.Text = He Combolbat. Text ie. ComBOBENE Text = GenerarFactura ("e.Combosen2.Selectedvalue) Venta. Showalog() Close) end Sub EMA DE COI TA ¥ Noubkamos-en elevento del formulario EF owetsove [=] ‘Y ascribimas el siguionte eddigo: Private Sub F MouseHove(ByVal sender As Object, By\al © As System.bin« Ne.ComboBGn6.Text = Generarfactura(e.ConboBox?.Selectedvalue) End Sub ¥ Dentro del botén cancelar escribimos el siguiente cédigo: | concsr Private Sub BTH_CANCELAR CLick(ByVal se Me Close() End Sub SISTEMA DE COMPRA Y VENTA ‘iis mae a wl conprowernoa L}[ IT ‘op STOCKACT CANTINA. —FRECIO. MRORTE CN} = =) suerora | ovis, | vo. fh | SISTEMA DE COMPRA Y VENTA Imports System.Data Imports System.Data, Sqi¢lient Public Class Compra Private obetaddapter As SqlDeteddepter Private oDataTable As DataTable Private obataRow As Oxtaiow Private KomandBuilder As sql Comand®ulléer Private PosFilaact As Integer Private datas As flew Oatateble Private data6 As New Datstable Dim Lept, lapz, lap3, leaps As String ‘Olm Laps as Integer Dim Lopli, 1ap22, lap33, lapéd As String Dim Lapss As Integer SISTEMA DREOMPAY VENTA nent il even nad detfcemsana esctimen ef squcene cya: Prtsate 0 Fora Lomt(Byen wander as System. coject. Bal # Ae Systm. Gowecacgs) mantles me “TertSoet Ssatied © Faite ‘estan. Sched ~ Faase ‘ectenh beable = Pale eRe oabled = Faee ‘tectoend tnaoleg « Vane oor tnatled «Pals Sevesonr temnied « False feecoows.onaled = False Sentech Scaled = Pale ‘asta fabled © fale exten: that # Pale oepceenl traping + tahoe ‘Setetinericheri, tooled = Faloe feraraer tasted = reloe ‘Suttand. (sabes = Jalen ‘Rietond trues = fate (fo sonia towne = “alee Spttor toasted ates Seamer = hb eomnenet Lire attakmapton) (Setatanpter » hw uabestantarter("Seloet * Fran Ovtaliacimpre SHOE RY ref artury™, OME Senestacia = tee De pein ‘Sercanaopter."ild(vortaranie) te Se | Yhuego Games une fueien de non relma qué rode aperintirmplacls cade tod: Prdunte Su Limstar) Texttorl ert = Metnang: Fextoorlfort = het Yeraboxa, eet = uetaiog TertBond oct = ety eaeban tase > eng em, Te = ote Ferttont Teet = uote | bens it btn nuevo erties Sige cdo: Cire) Prkunue uh Buttars chicaceyed oe Sok nab = tree ttond ted = Trae Tasttonk Sealed = Woe Gonos enabled» Trot textbox. trables © Ire ‘boon enabled = Tove “fentton?steapled = true Jesttenli Eoakled = tree tonal = Troe Lreetinet eter tneieg = Year ‘covendorgotm.guertar = 1 rahavas tabled = Fahis muarday- Anse = tran encore Enabled = Pale uctont, tabled = True fheans. toned = Tro FecButtond ned = true ‘ewes, Feeat,) SISTEMA DRCOMPHAS vera, “© ion det noton pari exeibunasel geen céiga? ‘geen ttn ee stn, A etme) As Pr Sitemeter atte: yey erm et) SSSA! Sanit es | comeuacin.. 1 cumnador.pats_putrtar « Tey v7 Spat ‘She NenteeylalMatir As tng Shring( taps ("update tngeebsPreintin Mak TAAMRLSalangh ahars AtAcchege", eh4FE)}) (Dip onde Bo tw lon (Rartmngleliminar, CONEY). ‘ce Faremeters Aas ovelue"Ba = fe PevtDend TET) Sestteni thabed + False Sronte.teebied + tele ‘pertboe tonbed « false ‘Bioe teebled = Palace ‘Temes coated - Paise fevrboad. Enabled + False ‘erabech Suuted = False Testieali.Eeebled = fale Yeattontt tabled = Pale Feottenia.trabled © Felner Lbeterinerictara. Caled © Taloe ‘call cargaroeeaaria() “pagan | ent it bot cancelar etna ten ei: (crea etna Sub muttont ee Ayal uae “Terttoal ambled = Falee Tenebond, teed = Faden tentbond, Enabled = Fale Siooe-trabled © Palos Testtou? ened = False textbone. ened = Fale ‘eettong.engled + False Tecthonlh Enabled = Fakes Testa. Enabled = Fala Toten? trad = Fala eee fmcher Preble» False ‘rauardartnahied = False Fin sane enebled = Palye lad = False | Dent det otan apreqaresiitumos et squlerte wekga: mana) tents Ss YmAONOAN.SAACLERVR andr As Yam Dey BH # RE. wrnarge) MeMLAS 9M ABNAR. ete CPoounnte Famesoaar geavete eaip pe Rl ceepeecieT eT) Dim om aw om tee mgr, COM) seen | comeuacin., esdetgrieX() sieagritnys omracti) meee Astahont-Encblad ~ Fale shes. tuanted ~ Fala Tart tnab ed = ‘treo traded © Fertfont Enabled > Guestberricterd-tyatled = alse Conbube Tort = | nent it botén quar exmBiunas et sgusent cio (ota) ‘rtineg sab enka CEL) sander a yetemsoe 6, Wal AE“ ete) Hemant hick ‘nes open) Mio tguervert Beem rtvg Ween rom BETALLECINELASUME Nrnoctyren'* Oe Yonnd Tonk A * sn Cadlgee™* @ AeethiYo ‘im datangrrart ha tre tmnt sthreart, COREE) eens Peevey) ‘anatstieer) omar) ‘GE pent) ‘ie guerre dtm Shing andete (Fon tmp Glo" A nett tert 8%) Ba Metaepercert As tow nitomnigahoremr, CORE) reasaserrent Earstetongverl ‘aner chee) erage) Ureguitar Enea © rater | 1 Greamostnatuncon para cepa dita: det producm en! oom dé camera ‘STOGUCT CANTONS PRED a | Greamos natuncon para cetarlo ditaten la matiGrd ew a mofienta de agregat = Publle Sub Cangetatacta) Din elatec 2 hen 4s ns Di slageoe tat acemse Bis cae Seeger Shales Saketheule,Orse-tpeten tant datyPrecieyiaparse tome Getabie whace trabecaneston” & Tete test & a utes SIyoROL » ola00c,taecutatanter Setaoriviet. Row Clee) 1 slegeon masons Toes “ie oleonon toma ‘ear Vince) ‘Setacettvina Term, ¢)-viluw & Detetebivind teats © Sttedrbiviee dtee(2y 6) Datsaebdvied.Teen(3, ¢)-Velue = ‘Stecefvine. emt, €).Wilue © encet tna todd comes Chena) re tna 1a, | + creamarcira tice 98a carparlclsos ena otra Gstacriiew2 gem en miso farmulara came: Prat Sap saragrtg2() Lagan) cme oo) ‘in sqch 43 Rew coment - Seelect Sefign, hombre, Carried, *encin, dnporne from GetalleCewpra whevs Wwatectree!* d teriaond. test & °°", cone) Gramps ena Aireiin pas queued yodoyapregs neater ce apepuan tan eleSelga, tack susie metab temparal stock yee eaguen Ver chtonen fs oattridvend del wemporl eck: rrioats Dam aetna id) ‘Em Greek ‘sage ae ine Scams "aaBaen cage, RACAL Pr TaerSLSNACA”, COMER) (bn daemiges Ai fr baler ahinnt Cue ‘iecet.Clewrt) ‘Serasacs Pall acne) coer tionet} tt Sn | eamoscra tunclén pe sina elt de compra pero execdo al tbade seccmecto (EN: Z wer, memes ee ee z fom ® Peluste tab femaeretattigeesed) “imo won Calon in Total sa ting ‘in Cal at Cateye? Wp DeCAOrLevinw) .Cewrace coum fe tach fe A Davee 10 ReGen otal Va{ron-tallaGt}-Unlueh ‘aget swcoers Le lis y fas osama eat Tata Testring apal o eet f total valve eatSonie test) = inesTesttela; Test > vale, TemPona®, text) ees Velie reeesonzs. tt) | ceamoscra funcé pe sia lta de compa per de execdoal*Bod cocumecto (BD: sent ait boten sar eertamerstaigiene cto: Prague 3s Burtana cltea(Dyrel var ‘onduardar.tnabled = Pale tance: tabbed = th ucla), ana Sa | neve it botén buscar protect exam axis guerte adga teat tls tan LER (OA) sandr A ys Sco preeawe™ Enea Shaeblaliag() Dente del oton buscar ame oe mina eteuerie cg: a etn Sab Ruttond vale, TemPona®, text) ees Velie reeesonzs. tt) | 1 Greamos ova tic p2c simar etait de venta prod sleednat pad doaimce Di: ses0ra a vor. ¢ Prbenhe Sah Sener Betaltngresaty sent ait bot slr eertamarstaiguene tga: Phente Bib Better SLSCA{Oyie Soe ‘encuardae.inatiad = False Minteve. tied = to pevcleset) | ear dt natn Buca cite eaertimr eaiperte ca CHUA aca inte ingreses wa Dente del oton buscar ame tina eteuerie cg: aa ta Sh mstnon) CALER(O/ AAR Vander A Sicoe prasita- factors Snewbiasog( et Den del even Toechanged de a cxjadetenade wacanidsdecorbenex elcguletecadgn: ‘SEA reveee tenn) Peouts Sut Test Bae? TectOungesiyenl sander Au System Soest, Aye eae Seat ‘Tesstend, Text > Val Tentaan?,Taxt) * Yai{testhoed Tart) ‘Teestont Tne = Val(Semprtond. tant) ~ val(Pectten?. Peon) EF Welftetextbont tert) 9 Ual(C@omotord-Fevt} Toes (COMTIDAD SRUFICIENTE', rugtonstyie-Cratdeal, “ABVERTENCEE“) Tevtnox?-Test = Me. texthou? Text, 1, uan(-Tewtn’.Teet) = 1) ton? Selectliositarh = Gane evita? Test) fale ba fe Teetbox? Foownt) tna Flu SRSA. Ensbed = Trae ent i | Greamostnatuncon pars qué mies 9c de nesta anielos Se acusicen at mamieaa de vender inate ul) Acta arse) ‘un tan tneeee™ oaeeeree ome) | 5‘ Greamos ra ncn es Fncion me aa perminecumbr as urclnes de acuerdo a1 3B de documieto qu uno a lg en cambfFaCTS ats} Oren T ir) = fem —_| vom ee Bolete: s yosteccone exe tipo de-cocume mome va cumple i 11 ¥sCeoherd-blactaiton = “eRe Phe ssh stahesoon cirretstingesent) 1 recmecoora Selecta + “wet Thee acu siyossiaccone oo tpde documenta me acim smortoratineeser() to TT ea tnd oe © Dent ait exon seececindenChanged et combs bate docament amamas 21s fulenquefenas creado nea! ESTE omtston setactsstna = wen | enue it botén cancelar etna ten cin: ch agp ae anes e078) etoge 431) naar a0) ecard, tnanied = Storuevestnebied = Troe ertors. Emad = Palse Eintervaribnabled = Troe Tevedoct. cubed ~ Fale exten? Stated = Palas Conbctnd. Eeabled = fale ‘entheas.habled ~ Paine ‘oe tnabed = Fale Sette Erebled = Palo terthout Enable! = Fale Ferttonsetablet = Flee ‘esttoaie.teahbed = false im panda habe» Pie fevBetterd,teabled = fale Stngattar,beabled = tna | bent dit on arena exiimas esque ego: (a8) Petowth San OTK ABNER, CLLCHORL sender Ao System TF neste yun ¢ As ayrte ee Din Aavtoagngresar Ax tes Strog( ype (Shnsart Lote Babes baht WroPstare Octet “cant taba, Teports onluaiporefectorn, Oocieet§LALL0 eho ee pe, Poe ‘bln end as Hew alt snenet taught ngresar, 8 me teveet + stpegst-Festrine esirmphics Ormedtring( tet, Frente, Broche, 408, Mb Wave aetna Sepagetcagts Sent del evento TexChanged de a ape do a taotalescitimas aaiglene cso CTT Penna toate elt Su Tertbontl.tentChenged{8yal sender in brute ejesty Hy {1 tamuerie Testes. te) Town ‘resbebaO Yat LETRAS Teva ant) che ing Tosbdaatt elecRLoniong@h = TectSea?TeStrng. emg tn ie rime maces sass” ‘ci nce ARVO sou tom, ¥ SISTEMA DE COMPRA Y VENTA ‘Vamos realizar una compra de § productos de tipo RARINIRA: Tipo Documento Primero me mostrara el formulario detipo de documento que voy hacer laventaal cliente. VENTADE *RODLETOS pon) RUE] Empresa: LOS SAUCES LAGUNA AZUL uc aera Teo ETAT =) So | oT) copeuente [a] Cone ne ETT, SCEN7OS Uno Orion NLEWO SOLES iene 2H } (TORE [anna (CCEA) Sur | AL = f (ies) [sae] f EMA DE COMPRA Y VENTA ¥ Luego hacemos clic en el botén Vista Previa: (=i a] nos va a mostrar todos los productos vendidos al cliente: Fecha del Pedido 2 29/10/2013 Nombre de la Empresa : LOS SAUCES LAGUNA AZUL Ruc de la Empresa 3 20267217785 Tipe Documento + FACTURA Nro de Documento oooo0001 “Dates del Cliente-- Cedigo del cliente + gooo2 Nombre Completa y DNI : foyer Detalle del Pedide Cedigo Deseripeion Cantidad Precio Imperte A001 Mouse x 8 2 0002 Teclado 1 4 34 ago03 Impresora it 54 4 Ag004 Camara Web - 32 32 A005 Monitor z 21 zi Subtotal: 169 rev: 32/48 Total a Pagar: 201 SISTEMA DE COMPRA Y VENTA ¥ Vamos realizar una compra de 5 productos de tipo BUENA: Tipo Documento || Primero me mostrara el formulario Nese BOER = de tipo de documento que woy hacer Javenta al chente. suo (001 | (ooo d | VENTA DE FRODUCTDS Fey Emoresa: LOS SAUCES LAGUNA AZLIL RUC ‘2OIG72I7785 iad seme aah) sto coocuene = Gs] come oye suBTOTAL ‘CENT SESENTAY NUEVE 01/100 NUEVO SOLES, HE homme Feces TOTAL ve EMA DE COMPRA Y VENTA ¥ Luego hacemos clic en el botén Vista Previa: F 7 ‘nos va a mostrar todas los productos vendidos al cliente: Fecha del Pedido 29/10/2013 Nombre de la Empresa : LOS SAUCES LAGUNA AZUL Ruc de la Empresa 20167217785 Tipo Documento : BOLETA Nro de Documento oo000001 “Dates del Cliente--. Codigo del cliente : cooo2 Nombre Compieto y DNI : royer Detalie del Pedido. Codigo - Descripcion Cantidad Brecio Importe AOOO1 Mouse i 8 8 hO002 Teclado 1 54 54 ‘B0003 Impresora = 54 54 ‘AOOO4 Camara Web i 32 32 AD0GS Monitor L 2i ai ‘Subtot: IgV: Total a Pagar: 169 SISTEMA DE COMPRA Y VENTA Y Ventas Blarias: 7 ‘vesiTas Dias pace AOI Be Hats BAAD —= ¥ _Importamos nvestras librerias: Inports System. Oata sports Systew.Data-SqlClicnt ¥ Dentro del botén cerrar-escribimas el siguiente cédigo: (cere) Private Sub Butt: Me.close() End Sub | SISTEMA DE COMPRA Y VENTA ' Escribimos el siguiente eédigo dentro del botén consultar: Private Sub Buttont_Click(Byval sender As System.Chject, ByVal e As System, 7? Dim cad As New SqlCommand("Spfac™, CONEX) cad ComandType = Conard ype StoredProcedure Tf Me.TextOoxd Text = °* Then cad, Parameters Addieithvalue("@IGCLiente™, System.c0tl1.Velwe) else cad Parameters Addie thvalue("BIdCLiente™, Me. TextBond, Text) End if cad. Paremeters AdduithValue("@fi", Ne.dtfi.Value.Oate) end. Parameters Adduithvelue("Bff™, Me.dtff.value.Oate) Diz da As New SqlGstaidepter(emd) Din dt As New DataTable da.Fill(dt) Me.DateGridview! DataSource Gatch ex As Exception Magbox( 4x Massage) end Try End Sub Y Procedimiente almacenado para realizar consulta de tal fecha a fecha y con el cddigo del cliente: « 2a CREATE PROC SPFAC @IDCLIENTE VARCHAR(S0}. ger tarerne, OFF DATETIME as SEGtt SELECT * FROM FACTURA fRERE IDCLIENTE-@IDCLIENTE Ax0 END QFr ano @FF) EMA DE COI TA ¥ Buscar Cliente: (Bosca Chere: BUSCAR CLIENTE BUSCAR FOR NOMBRE, Imports System.Data Imports System. Osta.SqlCliant Public Class Suscar_Clieate Dim ESTADO As New Boolean Dim READER As SqlDatalicader Dim contador_pate_guerder As Integer Private oOstaddapter As SqldetaAdapter Private eDataTable As DeteTeble vate oDataRow As Cataiow Private oComendBuilder As SqlComandiuiider Private PesFilatet 4: Integer Dim fille as Integer = -1 Dim TIPO As String = *~ Dim € As Integer = @ Dim pre As Double SISTEMA DREOMPAY VENTA 7: a a Rap a ap — a Soh itn TertOherwedttyvel wei by BYRD a A Seltaecteertaredd 0h ry re ctaeatavie.clene() TY Textson text © "> than InesoOetaAdmpter © row sllctablancee(“Seimct toon Chiente kre fe Hike” 8 Temtixdtext 8 8"; coma) thse he SOG SAdapter = Re Wa litaLdaiterdRelaet * ena OF ‘ns twbapter 1111 sataTaste) atch Aa Forays rfon Shon "Or a: nce” rm eh + men) he(S8) 4 exiMessagey | Greamos unatuncon para masta 0 carlos datas ene aataceview! cetfertana, Prtontn Sab Cargardueagris) (Din tencosgh as String ‘Tertosal + “select * frov CLiente oB05R SF sacLSante” ‘ame eps ia ead toe SoCs tastangl, cone) i ee ae genre im tt brinTah le acetiicar) beter vine Oatnfowree = oe Sas vo ba poemtbir hangar Taya Ba th arts frectvinowbra. fest © Sering.Permnt( Total Se Registrar’ (O°, dt-ow Court) (ner. Clase) catch ex 82 Sreeech agaea(exoneseage) wate mae | Den et orm Uae eadebomomos ef pense cigs: Prtanes Su muacae Chases, aad{ayent uaadar a Syonan mo fecr, Spal 5 an Steen. <.seein) ‘Smartt ie? tw 20 sects sarees) ‘Sorentcngter > bw sneaky er("Selers = From Client CHDEH QY ACLimite”, Comex) Tabvoneees Text = String Farawt{ etal de egintrons (9)", sbataPabte awe. Count 1 Dente defboten Reqresie at Glemesserbmas etsguerte cleo omen) eluate Sa Wetton Vecclanet} nd Ss | nent dil dion GeuMcuesoubiecdl deloancreew! ecrhimasel quent ego: = Geta bon. Sam(t, Seaton. at Elicwts.tevteocdstert = Setetrdaviect tet ly Schotoase) {Cinmes.testaoe) feet» Ostadrvinattaee3, e keene) SISTEMA DE COMPRA Y VENTA ~ Buscar Proveedor: [i bscar Proveedors BUSCAR PROVEEDOR = BUSCAR POR NOMBRE: — Fegeear } Inports Systes.Date Imports Systew.Dats.sqlClient Public Class Buscar Proveedor Dim ESTADO As New Boolean Dim READER As Sq l0atokeader Dim contador pata_guardar As Integer Private oateddepter As SqlDeteddapter Private oOatateble Az 0st3 Table Private oatafiow As Ostsiou Private oComandSuilder As SqlComandouilder Private PosFiladct As Integer Dim fila As Integer = -2 Dim TIPO As String =~" Die € As Integer Dim pre As Osuble SISTEMA DREOMPAY VENTA nent il dion Toxc hanged de a aps dem nace bar esontumas elsguldee ono ieee ine Private Sub Testbeak_TentChanged(hyvel sender Aa tysten SERGE, fv A Setentoemeicns} Anion Fenton testchenand ("Sebeet © from Proweedor tore fone 1ike'* & Seatot.toxt AW", COMER "he obetaidapter = Sew 1 ]Setatsnyter("Belect * 4am Prmwger; CORR) ee ‘ie abataidaptaeF11¢HeaoataTabie] cate ex an treet lon etanaeteneShow@trror a buscar” & che(i3) & eeamennagr) vay a ah | Greamostnatuncon para mostiae 0 carpe los dats ne mataceView! cetera, Prince a Garperoatae ia) s evseegh Au string tueengh = "iedect © Foo Prpeesen GASH OY [dBrewme™ Bio ot ew Batson | Dent i tor daa eadebowomos ef pense cxigo: Prise sult tescar_Proveedir_Load(S/tal sender ay Systes.ceject, yal © 8s Systen.tecinirys) ‘scemandbudbde? = te cannanonstise(e.coatandagtar) ‘SetoAdopier = bee Saldscablopcer(*Ealect = Prae Pronecder QHER Fr 3@rovendar”, CHE) Saonaratly « Son takstote Sterandapter-FilL(cowta able) rtartiviest Sataiource = coataTaale Pedant ievient sl lewterToadiieen + false Sei btateldviewk sHonhertteletetecs = "48s Cohen rant = Thawte rng a. tutatridvised oataseuren * sostafaate Anlnowe text » Dtrdng.Forue( "Total oe Regtstrexs (0)* 1 Dente defboten Reqresir at Glemesserbmas etsguerte clgo (smn remmee —_) eluate Sa Wetton Vecclanet} nd Ss | nent dil dion GauMcesoiiietndl deloancreew! ecrhimasel quent ego: Preeedoret. Tented ent» DetateL@viea{ten(5, frmenderes, Yerthon? ent = Batetebevientftee( 6, Prmcenioren Dptetinerieri,Yent = Bata idvient Steet) m herd males) =o SISTEMA DE COMPRA Y VENTA Y Buscar Articulo: 1B) Banca Articutosive BUSCAR PRODUCTO ee BUSCAR POR NOMERE- Imports Systes.bats ‘Systes.Data. SqiClient Public Class Susca- Articules Dim ESTADO As tiew Boolean Dim READER As SalDotateader Dim contader_pata_guardar As Integer Private oOataAdapter As SqiDetaAdapter Private eOataTeble As OstaTsble Private oDatafion As Dat ofiow Private oCemmandBullder As SqlCommilful lier Private PosFilaact As Integer Din fila As Integer - -2 Bim TIPO As String = “* Dis CAs Integer - @ Dim pre As Double SISTEMA DREOMPAY VENTA nent dil dion Toxchaned de a ap de de bua exerts silence an FoR Nom TtCnanges ertbont_Fexthaged Peta ah Toe To ‘resobaeaTablescl) FF Toytbenh Tent" thew (He ObGRahanptas = Ane OjSetakduptan {Matec * pram Aredia Maas maabew Line" "oa sont ahdapter ln Seth JomtChamerdoyial tater 8 yet. oevtee.Soooeargn) paien Pretend Fentcmarget estes tase 8, een) uabeet © trom sevbinine”, Comexy | Greamosunatuncon para mostiae 0 carpe tos datas ene aataceView! cetera, hana su corgaoanarta) Ste tensa A Sng estos = elect Yor Arteta OADM FY Codi seme. soe) Ban ead oe Shommandtentoegly CER) See wen owe ‘turtiear) ‘e-ortatriavent.tetasinee » ¢¢ SEikbinerectert = string toree("Yotl de eglates (0) tse tow ‘court cleat} eaten evs Trantor egponiecnecage) wot we | Den et orm daa eadebomomos ef ent cigs: (lorte Sle form endityeel sender au Syvtiechenny tried Ae tynten.toertécws) nd easel = tee ltemrerdtcder sattabeytor) Tact" fro Articles ORDON RY cadiga”, COMER) te Detacriavientetatource + obatarahle biventey.teet = Strdng.tareae(" Tamale Aogiotron) (@)*, stvtafable,Aews, Count 1 Dente defboten Reqresie at deucidacsrtimaset guess ceigo rawr) eluate Sa Wetton Vecclanet} nd Ss | nent dil dion GuMcuietouiietndl deloanGetew 1 ecmbimas el aquens codigo: CET overview Cottane + ‘ravate Sat OntadeheviendcetbreuseboubleClich(ayval sender a8 cbject, TY evtoainden ¢ 8 foto fait Sa deioalon. Fenton! Text = Detar lien mm(@y « Mafnken) Wave Aruicalon-FestBout.Tevt © batatridviecl ext emcee) Nol Ieticalon-TratBow). Test = DiteOriivineL, TC soutien) ale AartdeulonTestBou4, Text = DAEAUPiN jen Ta 9] €emtgee) Nae hresctanet) fos | sexmaro Mend asap atest im aria es doice eatin aisles opinones de lamar todas rms ySene evar de gure Mem icin a a ee Suteciret damit) trea | neste ela pestna stem exin on ab meni Gee | Regine Lied fapoter Umamierbe Aca ets ¥ Sent de a pertha cepitre eainlor ih ment ssw | Fer Ls fees aro on Pree enum de a pestiha taco etn lossummends sie fii Harr Aye Anas Sateme agate | nent de ta pesbha dorepoitesentiatos xbmest: Siena fugit Lice [Rapaea Metamena Ajude ere ir stbesos ttegace Senin de a pertaha ecramlaneas et lr sub ment Snes Rien Uta Repanes | Foran | Ayuen Marilee Dee Tt ogee elses Dai ies | nent eta pest aps estin lat sb mend: Tw ge ee] | aoe Sent de a pertha hecramiaenss hayuna cpciy conde dice baquearacetenm etaapalin mea apermif tener tna septic en aca ‘uaa tiene uma cau Derdome que taceren cro hgae ygorelo xf nar weer que Bioquear et setera por segundadhas que reyes andra quepenermueamanee a davepars sae emer: SS ee en Cade SISTEMADRGOMPIUAY VENTA Ure vezhecho cic unsinsén apes Blapitar el fmiiarioe verte eas forma donde tarasiesenenirestn tagucadas slo inca de tees donde poner mi save srk detiaqueade: tha esguenola dave de sogurded ot uaaro, presoramasta teclicene el oermlaca ecambia de dasho'y se desbioqucanlas meni obser: ae a SISTEMA DE COMPRA Y VENTA ¥ Primero tenemos que importar estas dos opciones: Option Explicit off Inparts Microsoft VisualBasic ~ Dentro de la herramienta escribimos e! siguiente cédigo: Orme Private Sub Timerd_Tick(ByVal sender As System.ob 8 = Strings Right(Me.Text, Len(Me.Text) - 2) b= Strings. Left(Me.Text, 2) FesText = 0 & end Sub Y Dentro del formularios load escribimos el siguiente cédigo: Privare Sub Ménw_Prinedpal_load (ayy Pe.Labell.visible = False Me -TRTBLOQUEAR.Visible ~ False Label2.Text = Now End Sub ~ Bentro del evento KeyPress de la caja de texto escribimos el siguiente ed digo: aaa BLOGUEADO INGRESE SU CLAVE DE ACCESO Private Sub TXTBLOQUEAR_KeyPress(ByVal sender Ax Object, Syve If Me. TXTBLOQUEAR. Text ~ ToolStripStatusLabel3.Text Then Me-BackColor = Color.white Me.HenuStriptEnabled = True Me.StatusStripl.Wisible = True Me. TXTBLOQUEAR.Text = "* Me.(abell. Visible « False Me. TXTBLOQUEAR.Visible « False End If End Sub EMA DE COI TA Y Bentro de la pestafla ayuda - sub meni salir escribimos-el siguiente cédigo: Sinema Regete Ustado Repertes Haremienta: | Ajuda | ral ACERCA DEL USUARIO Private Sub SALERTooLStripMenurtes Click(Syval sender As Systes Ole S = Msgox("Dexea Cerrar”, Mighoxstyle.vestte, “SALIR™) If S = vb¥es Then End else End af End Sub ¥ Dentro de Ia pestafia herramientas ~ sub mend Doc Tat escribimos el'siguiente cédigo: Stems Registro Listada Reportes | Harramientaz | Ayuda Manual de! Sistema Caleulacora Bloques del Sisterna Paging Web Private Sub DOCTXTTooLStripMenulten CLick(Byval st “la pestafia doc texto Shell (“notepad.exe", Appllestyle.MarealFecus) End Sub Bentro de la pestafia herramlentas ~ sub menu Bloquee del Sistema escribimos e! Manual de! Sistema Calculadors Dac, Tit SISTEMA DE COMPRA Y VENTA Private Sub BOQUEOOESISTEMATooLStript Me.MenuStrip! Enabled = False Me.StatusStrip].Visible = False Me.tabell.visible - True Ne TATBLOQUEAR.Wisible = True Me.Backtolor = Color.Red End Sub ¥ Dentro de la pestafia reglstro ~sub ment Proveedores escribimos el siguiente eédigo: Sistema | Registro | Listedo Reportes Harramientas Ayuda Private Sub CLIENTESTooIStriz Proveedores ShowOlalog() tnd Sub, Dentro de la pestaha registro ~ sub menu Clientes escribimos el siguiente codigo: Satema | Registro | Listede Reportes Herramientas Ayude ie | Private Sub COMPRAToolStri Clientes. ShowDialog() End Sub ¥ Dentro de la pestaha registro ~ sub ment Articulos escribimos el siguiente cédigo: Sistema [ Registte | Listado Reportes Harremientas Ayuda Clientes EMA DE COI TA Private Sub PROVEEDORESToo! Articulos, Showdalog() tnd Sub ¥ Dentro de la pestata sistema — sub meni Compra eserbimos el siguiente cédigo: Sistema | Regztro tistado Reportes Harramientas Ayuda Venta ‘Configurar impresora Private Sub PROVEEDORToo! Compre, ShewOdalog() End Sub Dentro de la pestafia sistema ~ sub ment Venta escribimos el-siguiente cédigo: Sistema | Registre Listado Reportes Harrarnientas Ayude Compra pete Private Sub CTUDADToc -Showoialog() tnd Sub ¥ Dentro de la pestafia reportes—sub mend Ventas Diarias escribimos el siguiente eédiga: Sistema Registro Listada | Reporter | Harramientaz Ayuda Articulos Entregedes SISTEMA DE COMPRA Y VENTA Private Sub VentasDiariastoolstri Dentro de la pestafla reportes — submenu Articulos Entregados escribimos el sigulente cédiga: Sitema Registre Ustede | Reportes | Haremmientas Ayuda Private Sub articulostntregadostoolstri Articulos_eitregados, Showeleg() End Sub Dentro de la postafia herramientas ~sub manu Caleuladora escribimes e! siguiente: ‘eédige: Sistema Registro Litas Reportes | Harramientas | Ayuda Manuel del Sistema Doc, Tt Bloqueo del Sctera Pagina Web Y Dentro de la pestafia herramientas — sub mend Pagina Web escribimes el siguiente cédigo: SS Se a Manual det Sistema Cateulndora Doc Tt floqueo de Sistema Dentro de la pestafia ayuda ~ sub menu Acerea del Usuario eseribimos el siguiente c6diga: Sistema Registro Linledo Reportes Harremientes | Ayude ACERCA DEL USUARIO | saur Private Sub ACERCADELUSUARTOT Showisleg INSTITUTO SUPETIOT TECNOLOGICO MeczOroLican ida cs Email: royerstudios@hotmail.com DECor TA Imagen donde se muestran todos los nombres de los formularios en el explorador de soluciones:

Você também pode gostar