Пример #1
0
        public string DoSave()
        {
            var dm = new PurInvDataManager();

            var retval = dm.DoSave(PurinvmainRow, Purinvdetail,isforsale, Whid);
            if(retval=="1")
            {
                Purinvid = Utils.Purinvid;
            }
            return retval;
        }
Пример #2
0
 public DsMaster.TEMPBCODEPRINTDataTable CreateBarCodeTable(string purno)
 {
     var dt = new DsMaster().TEMPBCODEPRINT;
     var dm = new PurInvDataManager();
     Purinvdetail = dm.GetPurInvDetailsById(purno);
     foreach (DataRow dr in Purinvdetail.Rows)
     {
         var dnew = dt.NewRow();
         dnew["ITEMCODE"] = dr["itemno"];
         dnew["ITEMNAME"] = new BlItemMaster().GetItemname(dr["itemno"].ToString());
         var _qty = int.Parse(dr["qty"].ToString()) + (string.IsNullOrEmpty(dr["BONUSQTY"].ToString()) ? 0 : int.Parse(dr["BONUSQTY"].ToString()));
         dnew["QTY"] = _qty;
         dnew["PRICE"] = dr["SPRICE"];
         dt.Rows.Add(dnew);
     }
     return dt;
 }
Пример #3
0
 public void GetPurinv()
 {
     var dm = new PurInvDataManager();
     var ds = ClsGetData.GetPurchaseInvByid(Purinvid);
     foreach (DataRow d in ds.Rows)
     {
         Supid = d["SUPID"].ToString();
         Invno = d["INVNO"].ToString();
         Invdate = DateTime.Parse(d["INVDATE"].ToString());
         Duedays  = int.Parse(d["DUEDAYS"].ToString());
         Spdiscount =decimal.Parse(d["SPDISCOUNT"].ToString());
         Adjvalue = decimal.Parse(d["ADJVALUE"].ToString());
         Netvalue = decimal.Parse(d["NETVALUE"].ToString());
         Whid = d["WHID"].ToString();
         Hold = bool.Parse(d["HOLD"].ToString());
     }
     Purinvdetail  = dm.GetPurInvDetailsById(Purinvid);
   //Purinvdetail = ds1.PURINVDETAIL;
 }
Пример #4
0
 public int UpdatePurInv()
 {
     var dm = new PurInvDataManager();
     return dm.DoUpdateInv(Purinvid, Supid, Supname, Invno, Invdate, Duedays);
 } 
Пример #5
0
 public static int GetLastReceived(string itemno)
 {
     var dm = new PurInvDataManager();
     return dm.GetLastReceivedPurchaseQtyWithBonus(itemno, Utils.Company); 
 }
Пример #6
0
 public static void DoPrint(string purid,decimal totalsale,decimal totalcost,decimal profit)
 {
     var dm = new PurInvDataManager();
     decimal pp = 0;
     if(totalcost > 0)
         pp = ((totalsale - totalcost) / totalsale) * 100;
     else
     {
         if (profit > 0)
             pp = 100;
     }
     var rpt = new PurchaseRpt { Company = Utils.Companyname, Header = "Purchase Invocie", Docno = purid, TotalSale = totalsale, TotalCost = totalcost, Profit = profit, ProfitPer = pp };
     var ds = dm.RptPurchaseInv(purid, Utils.Company);
     rpt.DataSource = ds;
     var printTool = new ReportPrintTool(rpt);
     printTool.ShowPreview();
 }
Пример #7
0
 public static void DeletePurchaseInv(string purid)
 {
     var dm = new PurInvDataManager();
     dm.DeletePurchaseInv(purid, Utils.Company);
 }
Пример #8
0
 public static int CountInvoiceNo(string invno, string supplier,string purid)
 {
     var dm = new PurInvDataManager();
     var t = !string.IsNullOrEmpty(purid) ? dm.GetInvoiceCountWithHold(supplier, invno, purid) : dm.GetInvoiceCount(supplier, invno);
     return t;
 }
Пример #9
0
        void DoUploadPurchases()
        {
            txtstatus.Caption = "Uploading Purchases";
            Application.DoEvents();
            try
            {
                var dm = new PurInvDataManager();
                var dt = dm.GetPurchaseInvoiceNotSync();
                var syc = new RemoteSync();
                // GetMasters(dt, true);
                // syc.DoUpLoadItems(_Purinvids, true);
                if (dt.Rows.Count == 0)
                {
                    var drd = _dsdownload.NewRow();
                    drd[0] = "";
                    drd[1] = DateTime.Now.Date;
                    drd[2] = "Purchase Invoice";
                    drd[3] = "Nothing to Upload ";
                    _dsdownload.Rows.Add(drd);
                }
                foreach (DsPurchase.PURINVMAINRow dr in dt.Rows)
                {
                    if (Utils.PingServer())
                    {
                        //syc.DoUpLoadItems(dr.PURINVID, true);

                        var drd1 = _dsdownload.NewRow();
                        var retval = syc.DoUpLoadItems(dr.PURINVID, true);
                        if (retval == "1")
                        {
                            drd1[0] = dr.PURINVID;
                            drd1[1] = DateTime.Now.Date;
                            drd1[2] = "Item Master - Purchase Invoice ";
                            drd1[3] = "Upload ";
                        }
                        else
                        {
                            drd1[0] = dr.PURINVID;
                            drd1[1] = DateTime.Now.Date;
                            drd1[2] = "Item Master  - Purchase Invoice ";
                            drd1[3] = "Error   '" + retval + "'";
                        }
                        _dsdownload.Rows.Add(drd1);
// Purchase invoice
                        var drd = _dsdownload.NewRow();
                        drd[0] = dr.PURINVID;
                        drd[1] = DateTime.Now.Date;
                        drd[2] = "Purchase Invoice";

                        var ret = syc.DoSavePurchaseInvoiceInRemote(dr, dm.GetPurInvDetailsById(dr.PURINVID));
                        if (ret == "1")
                        {
                            dm.UpdatedSyn(dr.PURINVID);
                            drd[3] = "Uploaded";
                        }
                        else
                        {
                            drd[3] = "Error " + ret;
                        }
                        _dsdownload.Rows.Add(drd);
 // Purchase invoice
                    }
                    else
                    {
                        XtraMessageBox.Show("Failed to connect server ", "POS", MessageBoxButtons.OK,
                            MessageBoxIcon.Information);
                    }
                }
            }
            catch(Exception exp)
            {
                XtraMessageBox.Show(exp.ToString(), "POS", MessageBoxButtons.OK,
                           MessageBoxIcon.Information);
            }
        }