Exemple #1
0
        public static void update_Kontrabons_Id(Guid Id, Guid?Kontrabons_Id)
        {
            FakturPajak objOld = new FakturPajak(Id);
            string      log    = "";

            log = ActivityLog.appendChange(log, objOld.Kontrabons_No, new Kontrabon(Kontrabons_Id).No, "Kontrabon: '{0}' to '{1}'");

            if (!string.IsNullOrEmpty(log))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "FakturPajaks_update_Kontrabons_Id",
                    new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                    new SqlQueryParameter(COL_DB_Kontrabons_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(Kontrabons_Id))
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submit(Id, String.Format("Updated: {0}", log));

                    //update faktur pajak log
                    if (Kontrabons_Id == null)
                    {
                        ActivityLog.submit((Guid)objOld.Kontrabons_Id, String.Format("Removed FP: {0}", objOld.No));
                    }
                    else
                    {
                        ActivityLog.submit((Guid)Kontrabons_Id, String.Format("Added FP: {0}", objOld.No));
                    }

                    //remove sale invoices
                    DataTable saleInvoices = Sale.get_by_FakturPajaks_Id(Id);
                    foreach (DataRow row in saleInvoices.Rows)
                    {
                        Sale.update_Kontrabons_Id(Util.wrapNullable <Guid>(row, Sale.COL_ID), Kontrabons_Id);
                    }

                    //remove sale returns
                    DataTable saleReturns = SaleReturn.get_by_FakturPajaks_Id(Id);
                    foreach (DataRow row in saleReturns.Rows)
                    {
                        SaleReturn.update_Kontrabons_Id(Util.wrapNullable <Guid>(row, SaleReturn.COL_ID), Kontrabons_Id);
                    }
                }
            }
        }
        public static void update_Kontrabons_Id(Guid Id, Guid?Kontrabons_Id)
        {
            SaleReturn objOld = new SaleReturn(Id);
            string     log    = "";

            log = ActivityLog.appendChange(log, objOld.Kontrabons_No, new Kontrabon(Kontrabons_Id).No, "Kontrabon: '{0}' to '{1}'");

            if (!string.IsNullOrEmpty(log))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "salereturn_update_Kontrabons_Id",
                    new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, Id),
                    new SqlQueryParameter(COL_DB_Kontrabons_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(Kontrabons_Id))
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submit(Id, String.Format("Updated: {0}", log));

                    //update faktur pajak log
                    if (Kontrabons_Id == null)
                    {
                        ActivityLog.submit((Guid)objOld.Kontrabons_Id, String.Format("Removed: {0}", objOld.barcode));
                    }
                    else
                    {
                        ActivityLog.submit((Guid)Kontrabons_Id, String.Format("Added: {0}", objOld.barcode));
                    }

                    //remove faktur pajak and all items related to it
                    Guid?FakturPajaks_Id = new SaleReturn(Id).FakturPajaks_Id;
                    if (FakturPajaks_Id != null)
                    {
                        FakturPajak.update_Kontrabons_Id((Guid)FakturPajaks_Id, Kontrabons_Id);
                    }
                }
            }
        }
        public static void update_FakturPajaks_Id(Guid Id, Guid?FakturPajaks_Id)
        {
            SaleReturn objOld = new SaleReturn(Id);
            string     log    = "";

            log = ActivityLog.appendChange(log, objOld.FakturPajaks_No, new FakturPajak(FakturPajaks_Id).No, "Faktur Pajak: '{0}' to '{1}'");

            if (string.IsNullOrEmpty(log))
            {
                Util.displayMessageBoxError("No changes to record");
            }
            else
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "salereturn_update_FakturPajaks_Id",
                    new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, Id),
                    new SqlQueryParameter(COL_DB_FakturPajaks_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(FakturPajaks_Id))
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submit(Id, String.Format("Updated: {0}", log));

                    //update faktur pajak log
                    if (FakturPajaks_Id == null)
                    {
                        ActivityLog.submit((Guid)objOld.FakturPajaks_Id, String.Format("Removed Sale Return: {0}", objOld.barcode));
                    }
                    else
                    {
                        ActivityLog.submit((Guid)FakturPajaks_Id, String.Format("Added Sale Return: {0}", objOld.barcode));
                    }
                }
            }
        }
Exemple #4
0
 private void populateGridFPKeluaranRetur()
 {
     Util.setGridviewDataSource(gridFPKeluaranRetur, SaleReturn.get_Reminder());
     tpFPKeluaranRetur.Text = string.Format("Keluaran Retur: {0}", gridFPKeluaranRetur.Rows.Count);
 }